Powershell script for AD help
hi all,
i trying disable on 2 million unused window accounts in active directory. have powershell command running keeps on timing out. make simple, want use command #1 example found microsoft article. command #2 command running keeps on timing out. want insert command # 2, command # 1, unsure add or paste it. hoping can me this.
thanks in advance,
tt
command # 1: (i want use com # 1, however, don't know copy , paste parts in com # 2, com # 1. also, if need delete parts com # 1. )
$adobjects = get-aduser -filter {-not(useraccountcontrol -band 2)} -erroraction stop; $adobjects | foreach-object {start-sleep -milliseconds 200; $_}
command # 2: (timing out command)
get-aduser -filter 'name -like "*"' -searchbase "ou=users,dc=test,dc=abc,dc=ca,dc=com" | disable-adaccount
here article found below:
you on working issue. hre how enumerate enabled accounts , disable them. subject limits configured ad site.
get-aduser -filter {enabled -eq $true} | disable-adaccount
do not use "erroraction stop" should not errors on retrieving objects except if ad faulty.
\_(ツ)_/
Windows Server > Windows PowerShell
Comments
Post a Comment