-1
我想寫一個PowerShell腳本來刪除非常舊的AD帳戶。Powershell中的Remove-QADObject需要交互。需要一個出路
它可以工作,但是當我從PowershellGUI運行它時,它會提示您單擊yes/no。我查看了PowerGUI's Remove-QADObject documentation,但沒有提到靜音模式。有沒有人知道解決方法?
# Get the date that is about 6 months ago from today.
$dateObj = (Get-Date).AddDays(-180)
$oldADUsers = Get-QADUser -SearchRoot "OU=expired_test,OU=Students,DC=..." -AccountExpiresBefore $dateObj
foreach ($user in $oldADUsers)
{
Remove-QADObject $user
}
謝謝!星期一早上試試吧!非常感謝。 – user1866880 2013-02-15 18:26:10