I need to create a batch file that moves computer name object in Active Directory only if computer name contains some string, like:
If %computername% contains "LAP"
( dsmove "CN=%computername%,CN=Computers,DC=domain,DC=local" -newparent"OU=**Laptops**,OU=Computers,OU=Company,DC=domain,DC=local" )
If %computername% contains "DESK"
(dsmove "CN=%computername%,CN=Computers,DC=domain,DC=local" -newparent "OU=**Desktops**,OU=Computers,OU=Company,DC=domain,DC=local" )
What is the correct command please?