Jaber MM
asked on
script to move computer from default OU to named OU
hi all,
any one can have any idea how to move computer from default OU to named OU using power shell command .
for example UComputer is the new OU
mostly the script will work on the first letter of the computer name i.e. U for Ucomputer Container , M for MComputer Container
appreciate your help and support .
any one can have any idea how to move computer from default OU to named OU using power shell command .
for example UComputer is the new OU
mostly the script will work on the first letter of the computer name i.e. U for Ucomputer Container , M for MComputer Container
appreciate your help and support .
ASKER
@Patrick Bogers
thanks for your fast reply , so i need to have three of this for each OU
get-adcomputer computerName | Move-ADObject -TargetPath ‘ou=Ucomputer,dc=domain,dc =net’
where i can put the computer name to specify that it is start with a C or M letter
according to what i understand this script will move the computer based on the full name and what i need to move based on first letter
thanks
thanks for your fast reply , so i need to have three of this for each OU
get-adcomputer computerName | Move-ADObject -TargetPath ‘ou=Ucomputer,dc=domain,dc
where i can put the computer name to specify that it is start with a C or M letter
according to what i understand this script will move the computer based on the full name and what i need to move based on first letter
thanks
Get-ADComputer -Filter {name -like "C*"}
Run this to test if it is desired return. If so append
| Move-ADObject -TargetPath ‘ou=Ucomputer,dc=domain,dc =net’ To it.
Run this to test if it is desired return. If so append
| Move-ADObject -TargetPath ‘ou=Ucomputer,dc=domain,dc
Just curious, why not just permanently redirect
redircmp.exe "OU=Our Computers,DC=Domain,DC=com"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Full solution provided.
https:#a42095427 doesn't move from the default Computer container, and it doesn't support the required "move multiple computers to different OUs based on their names" mapping.
@Shaun:
that won't work in this case, because the target OU needs to be determined dynamically based on the computer name.
https:#a42095427 doesn't move from the default Computer container, and it doesn't support the required "move multiple computers to different OUs based on their names" mapping.
@Shaun:
that won't work in this case, because the target OU needs to be determined dynamically based on the computer name.
Cheers