Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Move object fails

$
0
0
$Inactive_computer_OU = "OU=_test,OU=InactiveMachines,DC=BakerINC,DC=Local,DC=Com"

function inactive_computers()
{
    Set-QADPSSnapinSettings -DefaultSizeLimit 0
    $old = (Get-Date).AddDays(-90)
    Get-QADComputer -IncludedProperties pwdLastSet -SizeLimit 100 | where {$_.pwdLastSet -le $old}

    }

    inactive_computers | Sort-Object -property 'Name'

    Write-Host "$old"

##############################################

The code above works and it returns 100 machines.  But when I try to move them to the InactiveMachines OU it errors out.


Move-QADObject $old  -TargetPath $Inactive_computer_OU

When that line of code runs I get this error.

 
Move-QADObject : Cannot validate argument on parameter 'Identity'. The argument is null or empty. Supply an argument that is not null or 
empty and then try the command again.


How come?   And how do you fix this?  thank you.  

mqh7


Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>