您好,登錄后才能下訂單哦!
技術(shù)無所謂貴賤,既然曾經(jīng)做過就總該是要留下點(diǎn)什么,畢竟做技術(shù)這些年給我們留下太多太多的成長經(jīng)歷,總有人問這些已經(jīng)很皮毛了為什么還要寫,其實(shí)沒那么多花哨理由,就是想著做或者不做這一塊總是要對過往做個簡單歸總,習(xí)慣已成自然,雖然因?yàn)榉N種原因頻繁隔斷更新,但一有時間就想著寫點(diǎn)什么,希望N年后還可以幫到更多有需要的人。本章節(jié)對Active Directory的日常OU組織單位新建、移動、刪除等內(nèi)容進(jìn)行簡單介紹,方便日常管理。具體如下:
新建OU:
1.打開Active Directory用戶和計算機(jī),右鍵選擇 新建——組織單位:
2.在新建對象中輸入組織單位名稱,這里可勾選"防止容器被意外刪除",也可根據(jù)實(shí)際環(huán)境不做勾選操作,生產(chǎn)環(huán)境為防止誤操作建議勾選,點(diǎn)擊確定繼續(xù):
3.新建后OU信息如下:
4.也可以在控制臺中點(diǎn)擊"在當(dāng)前容器中創(chuàng)建一個新的組織單位",生產(chǎn)環(huán)境中會根據(jù)公司架構(gòu)進(jìn)行對應(yīng)OU組織單位創(chuàng)建:
5.輸入OU名稱:
6.按照公司架構(gòu)新建對應(yīng)層級OU,組織結(jié)構(gòu)信息如下:
命令行查詢當(dāng)前架構(gòu)下OU信息:
a.命令行查詢當(dāng)前OU信息:
方法一:dsquery命令查詢當(dāng)前OU信息:
dsquery ou
方法二:Powershell命令查詢當(dāng)前OU信息:
get-adorganizationalunit –filter * |select distinguishedname
模糊查詢OU信息:
get-adorganizationalunit –filter 'Name -like "Group*" |ft distinguishedname
精確查詢OU相關(guān)信息:
get-adorganizationalunit –filter 'Name -like "Group3" |fl
命令行創(chuàng)建OU:
1.dsadd ou命令創(chuàng)建OU:
dsadd ou ou=xxx,ou=syncall,dc=azureyun,dc=local
2.powershell命令創(chuàng)建OU:
new-adorganizationalunit? -name xxx –path "ou=syncall,dc=azureyun,dc=local"
查詢新建OU信息:
重命名OU信息
1.rename-adobject重命名OU信息:
rename-adobject "ou=oldouname,ou=syncall,dc=azureyun,dc=local" –newname? newname
命令行查詢重命名后OU信息:
get-adorganizationalunit –filter * |select distinguishedname
刪除OU信息:
a.remove-adorganizationalunit刪除OU:
remove-adorganizationalunit? -identity? "ou=xxx,ou=syncall,dc=azureyun,dc=local"? -recursiv
根據(jù)提示回車確認(rèn)刪除,我們發(fā)現(xiàn)報錯信息提示無權(quán)訪問,即使我們通過強(qiáng)制刪除也無法完成刪除操作,此時我們是否想起在上邊新建OU勾選的"防止容器被意外刪除":
b.選擇查看——并勾選高級功能:
此時我們會看到比之前結(jié)構(gòu)多太多的信息:
c.選擇我們要刪除的組信息,鼠標(biāo)右鍵選擇屬性:
d.定位到OU屬性框中"對象"一欄,取消勾選"防止容器被意外刪除"并點(diǎn)擊確定:
e.此時我們再執(zhí)行刪除命令:
remove-adorganizationalunit? -identity? "ou=xxx,ou=HelpDesk,dc=azureyun,dc=local"? -recursiv? -confirm:$false
刪除成功,再次查看當(dāng)前OU信息,已無法找到Group1相關(guān)OU信息。
f:我們也可以通過命令行取消勾選"防止容器被意外刪除",命令如下:
命令行取消勾選:"防止容器被意外刪除"
Set-adobject –identity? "ou=xxx,ou=HelpDesk,dc=azureyun,dc=local"? -ProtectedFromAccidentalDeletion:$false
移動OU:
圖形化移動OU:
1.右鍵要移動的OU信息,選擇"移動":
2.選擇要將對象移動到容器的新位置,單擊確定繼續(xù):
3.此時提示我們無法移動對象,因?yàn)榫芙^訪問:
4.顯然是因?yàn)镺U對象屬性中勾選"防止對象被意外刪除"選項(xiàng),取消勾選并確定:
5.成功移動OU組織單位:
Powershell命令行移動OU:
move-adobject –identity? "ou=xxx,ou=Syncall,dc=azureyun,dc=local"? -targetpath? "ou=HelpDesk,dc=azureyun,dc=local"
報錯信息同樣是因?yàn)闆]有去掉勾選"防止對象被意外刪除",這里通過命令行取消勾選,并再次執(zhí)行移動操作,成功執(zhí)行,可通過命令行查看:
Set-adobject –identity? "ou=xxx,ou=Syncall,dc=azureyun,dc=local"? -ProtectedFromAccidentalDeletion:$false
dsmove命令移動OU:
dsmove ou=xxx,ou=Syncall,dc=azureyun,dc=local –newparent ou=HelpDesk,dc=azureyun,dc=local
刪除OU:
1.dsrm命令刪除OU:
dsrm? ou=xxx,ou=Syncall,dc=azureyun,dc=local
2.Remove-Adobject命令刪除OU:
Remove-Adobject –identity "ou=xxx,ou=Syncall,dc=azureyun,dc=local " –confirm:$false
本章完。
歡迎關(guān)注微信公眾號:小溫研習(xí)社
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。