Then find the correct OU where you want to move all computer objects.
Note: We assume we need to move the computer accounts in Servers OU under the nilabh.com domain.
Run the following script to move all computer objects listed in the notepad file to the required OU.
$Servers = Get-Content "C:\servers.txt"
$TargetOU = "OU=Servers,DC=nilabh,DC=com"
$TargetOU = "OU=Servers,DC=nilabh,DC=com"
ForEach( $Computer in $Servers ) {
Get-ADComputer $Computer | Move-ADObject -TargetPath $TargetOU
}
Get-ADComputer $Computer | Move-ADObject -TargetPath $TargetOU
}
No comments:
Post a Comment