Tuesday, December 3, 2013

Update UserPrincipalName–PowerShell Script

Here is a PowerShell script which you can use to update UPN (UserPrincipalName) in Active Directory

Import-Moudle ActiveDirectory
Get-ADUser -Filter * -SearchBase "OU=OU1,DC=Sivarajan,DC=Com" | ForEach {
$UpdatedUPN = $_.GivenName + "." + $_.SurName + "@Sivarajan.com"
Set-ADUser $_.samAccountName -UserPrincipalName $UpdatedUPN
}

I am using the Firstname.Lastname@domain.com format.  You can update the following line based on your UPN format.

$UpdatedUPN = $_.GivenName + "." + $_.SurName + "@Sivarajan.com"

2 comments:

Can you substitute setspn in order to update an SPN in ADUC?

Thomas, a skilled Pay Someone To Do My Dissertation For Me, partners with Dissertation Educators to deliver exceptional results. His dedication and expertise make him the ideal choice for all your academic needs.

Post a Comment

Popular Posts

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More