Monday, November 11, 2013

How to Disable and Move a list of computers in Active Directory

If you want to disable and move an object in powershell using the pipeline you can if the cmdlet you call supports the -Passthru property. This way you could make a single line powershell that would grab a list of objects, process those objects and then passthru the to the next pipeline.

get-content c:\temp\test.txt | % {Get-ADComputer $_ | Disable-ADaccount -PassThru | Move-ADObject -Targetpath "OU=xxx,,DC=DomainName,DC=COM"} 

If you find this article useful please leave me a comment or click on an ad to show your support.

No comments :

Post a comment