Not exactly sure why I am getting this error - input object cannot be bound to any parameters for the command either because the commmand does not take pipeline input and its properties do not match any of the parameters that take pipeline input. Any assistance is appreciated
Code snippet below
$Session = New-PSSession -ComputerName DC1 -Credential $Cred
Import-Module ActiveDirectory -PSSession $Session
$comp = $env:COMPUTERNAME
if ($ComputerName -eq $null) {
Invoke-Command -Session $session -ScriptBlock {$using:PC
}
if($comp.substring(5,3) -imatch "Dbs"){
Get-ADObject $PC |
Move-ADObject -Targetpath "ou=Database,
dc=com,dc=company,dc=net"
Write-Host "Moved to Datbases"}
}
Remove-PSSession -Session $Session