This is about as simple as it gets, and I'm flummoxed and frustrated.
What on Earth am I doing wrong?

Win7, powershell v2.

I borrowed this script:
http://community.spiceworks.com/topic/508041-bulk-move-computer-objects-powershell

and run it like so (the 3rd line might be wrapped) and get the following error:
     Import-module activedirectory
     $oldcomputers = get-content c:\batchfiles\computers.txt
     foreach ($computer in $oldcomputers){Get-ADComputer $computer.CN
| Move-ADObject -TargetPath 'ou=DeadComputers,dc=example,dc=com' }

Get-ADComputer : Cannot validate argument on parameter 'Identity'. The
argument is null. Supply a non-null argument and try the command
again.
At line:1 char:52
+ foreach ($computer in $oldcomputers){Get-ADComputer <<<<
$computer.CN | Move-ADObject -TargetPath
'ou=DeadComputers,dc=example,dc=com' }
    + CategoryInfo          : InvalidData: (:) [Get-ADComputer],
ParameterBindingValidationException


Reply via email to