puckstop34
Member
- Messages
- 14
- Reaction score
- 1
- Points
- 3
Hello,
I am trying to create numerous collections using Powershell and am receiving the following error. Currently using 1910 and never had issues prior to updating to 1910. From what I am seeing, the "New-CMDeviceCollection cmdlet is no longer available and can't locate the replacement
The script being used is below:
$Schedule = New-CMSchedule -RecurInterval Days -RecurCount 1
$NewCollection = New-CMDeviceCollection -Name "Script Test" -LimitingCollectionName "Test" -RefreshSchedule $schedule -Comment "Test Collection"
$NewCollection.RefreshType = 6
$NewCollection.Put()
Move-CMObject -FolderPath ".\DeviceCollection\Software\Testing" -InputObject $NewCollection
The error is below:
PS C:\Windows\system32> $Schedule = New-CMSchedule -RecurInterval Days -RecurCount 1
$NewCollection = New-CMDeviceCollection -Name "Script Test" -LimitingCollectionName "Test" -RefreshSchedule $schedule -Comment "Test Collection"
$NewCollection.RefreshType = 6
$NewCollection.Put()
Move-CMObject -FolderPath ".\DeviceCollection\Software\Testing" -InputObject $NewCollection
New-CMSchedule : The term 'New-CMSchedule' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:13
+ $Schedule = New-CMSchedule -RecurInterval Days -RecurCount 1
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (New-CMSchedule:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
New-CMDeviceCollection : The term 'New-CMDeviceCollection' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:2 char:18
+ $NewCollection = New-CMDeviceCollection -Name "Script Test" -Limiting ...
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (New-CMDeviceCollection:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The property 'RefreshType' cannot be found on this object. Verify that the property exists and can be set.
At line:3 char:1
+ $NewCollection.RefreshType = 6
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation:
) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
You cannot call a method on a null-valued expression.
At line:4 char:1
+ $NewCollection.Put()
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation:
) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Move-CMObject : The term 'Move-CMObject' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:5 char:1
+ Move-CMObject -FolderPath ".\DeviceCollection\Software\Testing" -Inpu ...
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Move-CMObject:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I am trying to create numerous collections using Powershell and am receiving the following error. Currently using 1910 and never had issues prior to updating to 1910. From what I am seeing, the "New-CMDeviceCollection cmdlet is no longer available and can't locate the replacement
The script being used is below:
$Schedule = New-CMSchedule -RecurInterval Days -RecurCount 1
$NewCollection = New-CMDeviceCollection -Name "Script Test" -LimitingCollectionName "Test" -RefreshSchedule $schedule -Comment "Test Collection"
$NewCollection.RefreshType = 6
$NewCollection.Put()
Move-CMObject -FolderPath ".\DeviceCollection\Software\Testing" -InputObject $NewCollection
The error is below:
PS C:\Windows\system32> $Schedule = New-CMSchedule -RecurInterval Days -RecurCount 1
$NewCollection = New-CMDeviceCollection -Name "Script Test" -LimitingCollectionName "Test" -RefreshSchedule $schedule -Comment "Test Collection"
$NewCollection.RefreshType = 6
$NewCollection.Put()
Move-CMObject -FolderPath ".\DeviceCollection\Software\Testing" -InputObject $NewCollection
New-CMSchedule : The term 'New-CMSchedule' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:13
+ $Schedule = New-CMSchedule -RecurInterval Days -RecurCount 1
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (New-CMSchedule:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
New-CMDeviceCollection : The term 'New-CMDeviceCollection' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:2 char:18
+ $NewCollection = New-CMDeviceCollection -Name "Script Test" -Limiting ...
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (New-CMDeviceCollection:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The property 'RefreshType' cannot be found on this object. Verify that the property exists and can be set.
At line:3 char:1
+ $NewCollection.RefreshType = 6
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation:
+ FullyQualifiedErrorId : PropertyNotFound
You cannot call a method on a null-valued expression.
At line:4 char:1
+ $NewCollection.Put()
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation:
+ FullyQualifiedErrorId : InvokeMethodOnNull
Move-CMObject : The term 'Move-CMObject' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:5 char:1
+ Move-CMObject -FolderPath ".\DeviceCollection\Software\Testing" -Inpu ...
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Move-CMObject:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException