Today I’ll post a simple mini script that moves machines to a specific ou in active directory via powershell
The machines will be listed in a txt file like this ( no spaces only intro )
example (machines.txt)
machine1
machine2
machine3
Create a ps1 with the following code
get-content machines.txt | % {Get-ADComputer -Identity $_ -server desigual.com} |move-ADObject -TargetPath “Destination OU”
the destination ou must be in CN format : “OU=EXAMPLE ,OU=COMPUTERS,OU=ES-BARCELONA,OU=ORGANIZATION,DC=COMPANY,DC=com”
Enjoy!