Move computer name PowerShell

When IT guys added machines to the domain as you guys know that by default, all computers automatically located on Computer container which mean that until they will not move the computer to their OU the new computer will not receive the GPO they suppose to receive, they will get just what you applied on Domain Level.

If we are talking about individual computer there is no issue moving the manual, but when we are talking about 40-50 computers it little problematic and what about belonging the computer to their appropriate OU.

Therefore, I want to share with you a good script which moves any computers with a specific convention name to their OU.

Any computer which his name begain we “COMPF2 ” and “COMPF1” move them to NEWComputers” OU:

Get-ADComputer -Filter {(name -Like “COMPF2*”) -or (name -Like “COMPF1*”)} -SearchBase “CN=Computers,DC=pelegit,DC=co,DC=il” | Move-ADObject -TargetPath “OU=NEWComputers,DC=pelegit,dc=co,dc=il”

Some basic command but usufull for a good tidy.