Posted On March 31, 2019

User Account Creation Script

kimconnect 0 comments
blog.KimConnect.com >> Windows >> User Account Creation Script
1. Create Account in AD
a. Select the correct container
b. copy memberships of another user
c. add “proxyAddresses”
 
 
2. Run this script to sync with Office 365
————-
$serverName = EXCHANGE01
Invoke-Command -computername $serverName -scriptblock { Start-ADSyncSyncCycle -PolicyType Delta } -credential kimconnect-admin

Set-MsolUserPrincipalName -UserPrincipalName [email protected] -NewUserPrincipalName [email protected]
 
# Script to set primary SMTP for all AD users
Import-Module ActiveDirectory
$users = Get-ADUser -Filter *
foreach ($user in $users)
{
$email = $user.samaccountname + '@kimconnect.com'
$newemail = "SMTP:"+$email
Set-ADUser -Identity $user.SamAccountName -EmailAddress $email
Set-ADUser $user -Add @{proxyAddresses = ($newemail)}
}
 
# Sample script to add new user
New-ADUser -SamAccountName Firstname.Lastname -Name "Firstname Lastname" -GivenName Firstname -Surname Lastname -EmailAddress "[email protected]" -PasswordNeverExpires $true -AccountPassword (ConvertTo-SecureString -AsPlainText "PASSWORD" -Force) -PassThru | Enable-ADAccount

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

How to Install RSA Radius Server

Configure firewall to NAT these ports for RSA:22 TCP49 TCP80 TCP161 UDP443 TCP1645 UDP1646 UDP1812…

Quick Info on Disabling UAC

Start > Administrative Tools > Local Security Policy > Local Policies > Security Options >…

VSS Error: Snapshots were found, but they were outside of your allowed context

Error: PS C:\Windows\system32> vssadmin delete shadows /for=c: /allvssadmin 1.1 - Volume Shadow Copy Service administrative…