清理长期不使用的计算机账户:
(inactive:单位 Weeks)
dsquery computer -inactive 52 -limit 1000 | dsmod computer -disabled yes
Get-ADComputer -Filter 'Enabled -eq "False"' | Remove-ADComputer
防止删除所有计算机账户:
Get-ADComputer -Filter * | Set-ADObject -ProtectedFromAccidentalDeletion $True
加域计算机重定向到目标组织单元:
redircmp "OU=Contoso-Computers,DC=nwtraders,DC=msft"
批量创建计算机账户:
for /L %a in (1,1,9) do net computer \\Test_00%a /add
for /L %a in (10,1,99) do net computer \\Test_0%a /a