M HYPE SPLASH
// general

Cannot bind argument to parameter 'InputObject' because it is null

By Emily Wilson

I am using SCCM 2016, Windows Server 2012. I am using the code below to move a collection to another folder. I get the error message Move-CMObject : Cannot bind argument to parameter 'InputObject' because it is null.

I've researched the error via Google but I still can't understand how 'InputObject' is null. I have seen other PS script formatted the same way and it is a working script. I'd like to know how to fix this and move the collection to another folder.

$sitecode = "123"
$colltomove = "JJJ00287"
$destcollfolder = '$($sitecode):\DeviceCollection\Test Operational'
$collID = Get-CMCollection -Name $colltomove
Move-CMObject -InputObject $collID -FolderPath $destcollfolder
0

1 Answer

This is tested and proven to work. You have to put " (double-quotes) at line 3 around "$($sitecode):\DeviceCollection\Test Operational" and "$destcollfolder" at line 9. Also at line 9 you need to use Get-CMDeviceCollection -CollectionId $collection | in addition to the Move-CMObject -FolderPath "$destcollfolder"

$sitecode = "123"
$colltomove = "JJJ00287"
$destcollfolder = "$($sitecode):\DeviceCollection\Test Operational"
$collID = Get-CMCollection -Name $colltomove
#Move-CMObject -InputObject $collID -FolderPath $destcollfolder
Get-CMDeviceCollection -CollectionId $collection | Move-CMObject -FolderPath "$destcollfolder"

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy