windows server 2008R2 AD域使用者UPN名稱還原

來源:互聯網
上載者:User

標籤:windows server 2008r2 ad域使用者upn名稱還原

windows server 2008R2 AD域使用者UPN名稱還原

今天在一個使用者環境碰到一個非常奇怪的事情,4000多個賬戶UPN名稱全部都為空白,和客戶溝通後得知是大概禁用過郵箱,不太確定是不是因為那個原因引起的,分析得知可能是由於刪除過Exchange郵箱,把AD賬戶都誤刪了,誤刪後通過第三方的AD恢複軟體把AD帳號都恢複回來了,造成UPN名稱都丟失了,具體情況見:

650) this.width=650;" title="1.jpg" alt="wKioL1SsCprCXh5-AAIKmz42bE0691.jpg" src="http://s3.51cto.com/wyfs02/M01/58/32/wKioL1SsCprCXh5-AAIKmz42bE0691.jpg" />

我們通過以下步驟把這些UPN名稱還原

步驟1、

匯出對應的AD帳號列表名單為csv檔案,命令如下:

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" />

步驟2、

使用函數A&"@"&C,將userprincipalname列填充為samaccou[email protected],同時向下拖拉填充至最後一行。

 

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="600" />

步驟3、修改完後,就是如下的效果。儲存到c:\userinfo.csv,方便後面的匯入。

 

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" />

步驟4、執行匯入命令

 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" />

步驟5、修改後,查看效果,UPN名稱均已全部修改過來。

650) this.width=650;" title="7.jpg" alt="wKioL1SsFuiADSrfAAIl3tcCHio751.jpg" src="http://s3.51cto.com/wyfs02/M02/58/32/wKioL1SsFuiADSrfAAIl3tcCHio751.jpg" />

 

 

本文出自 “周平的微軟技術交流平台” 部落格,請務必保留此出處http://yuntcloud.blog.51cto.com/1173839/1600003

windows server 2008R2 AD域使用者UPN名稱還原

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.