Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Disable AD Computer from txt file and move it to target OU

$
0
0

This is the script I have, but something is not right.

 

Import-Module ActiveDirectory

$computers = get-content "C:\disabled computer.txt"

foreach-object{

$computer | disable-adaccount

$computer | move-adobject -targetpath "ou=Disabled computers,dc=Domain,dc=com"

write-host “$computer will be moved to Disabled Computer OU”

}

 

Anyone can help?

Thanks


Viewing all articles
Browse latest Browse all 6937

Trending Articles