Hi,
I am new to Powershell (and this forum), and I am really hoping someone (anyone...) can assist me with.
I have been using a simple Powershell Script to move PC's in to specific OU's depending on their location. I obtained the information required using SQL.
The powershell script I have been using is:-
Import-module activedirectory
get-adcomputer PCNAMEHERE | Move-ADObject -TargetPath (Get-ADOrganizationalUnit -LDAPFilter "(name=NEW OU HERE)")
This script would simply move the PCNAMEHERE computer in to the NEW OU HERE.
Now, however, I need to move a computer object ONLY IF it is in our 'Computers' container, which is as an example - CN=Computers,DC=domain,DC=local
So is there a way of looking ONLY in the 'Computers' CN in Active Directory to run the above command?
I would appreciate your help.