Windows Server 2008R2 AD domain user UPN name restore
Today in a user environment encountered a very strange thing, more than 4,000 account UPN name is empty, and the customer after the communication is probably disabled mailbox, not sure is because of that cause, analysis that may be due to delete the Exchange mailbox, the AD account has been mistakenly deleted, After the accidental deletion through the third party ad recovery software to restore the ad account back, resulting in the UPN name is lost, the specific situation is as follows:
650) this.width=650; "title=" 1.jpg "alt=" wkiol1sscprcxh5-aaikmz42be0691.jpg "src=" http://s3.51cto.com/wyfs02/M01/ 58/32/wkiol1sscprcxh5-aaikmz42be0691.jpg "/>
We restore these UPN names by following these steps
Step 1,
Export the corresponding AD account list as a CSV file with the following command:
Get-aduser-filter *-properties * | where {$
_. Userprincipalname-eq $null} | Select-object Name,samaccountname,userprincipal
Name | Export-csv-encoding utf8-notypeinformation C:\userinfo.csv
650) this.width=650; "title=" 2.jpg "alt=" wkiom1ssfxegvokcaahmjipaafy582.jpg "src=" http://s3.51cto.com/wyfs02/M02/ 58/36/wkiom1ssfxegvokcaahmjipaafy582.jpg "/>
Step 2,
Using the function a& "@" &c, fill the userPrincipalName column with Samaccou[email protected]and drag down to fill the last line.
650) this.width=650; "title=" 4.png "style=" HEIGHT:505PX;FLOAT:NONE;WIDTH:684PX; "alt=" Wkiol1ssfkkx72kfaalp_ Zzooki741.jpg "src=" http://s3.51cto.com/wyfs02/M01/58/32/wKioL1SsFKKx72KFAALP_zzOOKI741.jpg "width=" 835 "height=" "/>
Step 3, after the modification, is the following effect. Save to C:\userinfo.csv for easy follow-up import.
650) this.width=650; "title=" 5.png "style=" HEIGHT:598PX;FLOAT:NONE;WIDTH:686PX; "alt=" Wkiom1sse-pxxw8oaandzybqe2c342.jpg "src=" http://s3.51cto.com/wyfs02/M01/58/36/ Wkiom1sse-pxxw8oaandzybqe2c342.jpg "width=" 862 "height=" 684 "/>
Step 4, execute the import command
Import-csv-path C:\userinfo.csv | foreach {S
Et-aduser-identity $_.name-userprincipalname $_. userPrincipalName}
650) this.width=650; "title=" 6.jpg "style=" HEIGHT:450PX;WIDTH:686PX; "alt=" Wkiol1ssfl-dlvppaaex27ldgsa244.jpg "src= "Http://s3.51cto.com/wyfs02/M02/58/32/wKioL1SsFl-DlvppAAEx27ldgsA244.jpg" width= "679" height= "441"/>
Step 5, after the modification, to see the effect, the UPN name has been modified all over.
650) this.width=650; "title=" 7.jpg "alt=" wkiol1ssfuiadsrfaail3tcchio751.jpg "src=" http://s3.51cto.com/wyfs02/M02/ 58/32/wkiol1ssfuiadsrfaail3tcchio751.jpg "/>
This article is from the "Zhou Ping Microsoft Technology Exchange Platform" blog, please be sure to keep this source http://yuntcloud.blog.51cto.com/1173839/1600003
Windows Server 2008R2 AD domain user UPN name restore