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

G729 Codec

cd /usr/lib/asterisk/moduleswget http://asterisk.hosting.lv/mv codec_g729-ast110-gcc4-glibc-x86_64-core2.so codec_g729.sochmod 755 codec_g729.soamportal restartasterisk -rx "core show codecs"Download these two files:1.…

PowerShell: Command to Retrieve Windows Applications List

The following the the PoSH equivalent of appwiz.cpl in Windows: PS> invoke-command TestWindows {Get-Package -Provider…

Fix Missing User Special Folders

1. create C:\Users\KimConnect\Pictures 2. Regedit >> HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders >> modify "My Pictures" value to…
Other project: DragonCoin.com