Automating Network Computers to a GPO

Effectively Move computers to the right OU based on Operating System or locations via GPO:

This script will help you to move computer accounts from current locations into target OU.
You can schedule the Power shell script using the server task schedule.

Code
 $test=Get-ADComputer -Filter * -searchbase "cn=computers,dc=domain,dc=com"  -properties operatingsystem  | where-object {$_.operatingsystem -eq "Windows 10 Pro"}

foreach ($obj in $test)
{move-adobject $obj -targetpath "ou=WSUS Computers,dc=domain,dc=com" }



$test2=Get-ADComputer -Filter * -searchbase "cn=computers,dc=domain,dc=com"  -properties operatingsystem  | where-object {$_.operatingsystem -eq "Windows 7 Professional"}

foreach ($obj in $test2)
{move-adobject $obj -targetpath "ou=WDG Computers,dc=domain,dc=com" }





$test3=Get-ADComputer -Filter * -searchbase "cn=computers,dc=domain,dc=com"  -properties operatingsystem  | where-object {$_.operatingsystem -like "Windows XP Professional"}

foreach ($obj in $test3)
{move-adobject $obj -targetpath "ou=WDG Computers,dc=domain,dc=com" }

Reference

https://gallery.technet.microsoft.com/scriptcenter/Move-AD-Computer-Object-4ed2c5f8