$LoadRunnerAccounts=Get-ADUser -Filter { Name -like "Loadrunner*" } | select -First 2000
$cred = Get-Credential
foreach ($LoadRunner in $LoadRunnerAccounts) {
Write-Output "Fixing $($LoadRunner.SamAccountName)"
$MailAddress = $null
$MailAddress = "$($LoadRunner.SamAccountName)@domain.com"
$proxyaddresses = "SMTP:$mailaddress","smtp:$($LoadRunner.SamAccountName)@mydomain.onmicrosoft.com"
Set-ADUser -Identity $LoadRunner -UserPrincipalName $MailAddress -EmailAddress $MailAddress -Replace @{'extensionAttribute4' = "O365Ready" ; 'proxyaddresses' = $proxyaddresses } -Server 'dc01.mydomain.com' -Credential $cred
}
- Details
- Category: PowerShell