Update 2014-12-04 : Microsoft will have a fix in the next release of the PowerShell cmdlets. (Not released yet)

I recently had a problem with the PowerShell command New-CMDeviceCollectionVariable creating only 1 variable.

I had to create a set of collection with variables in an OSD project. The goal was to create 20 collections with 7 different variables. Nothing too complicated, Powershell to the rescue !

So I start creating my script, everything went smoothly, no errors were returned. After verification on the created collection I found out that only 1 variable per collection were created instead of the 7 intended.

I decided to do a simple test to verify that New-CMDeviceCollectionVariable cmdlet was working correctly. I had problem in the past with another cmdlet and since then I like to double check if they work correctly.

  • Create a Test collection
  • Collection Test gets created

New-CMDeviceCollectionVariable creating only 1 variable

  • Create a new variable with a value assigned to the Test collection
  • Variable 1 gets created successfully

New-CMDeviceCollectionVariable creating only 1 variable

  • Create another variable using the same command
  • No output from the cmdlet. I can run New-CMDeviceCollectionVariable without error indefinitely but no variables gets created

New-CMDeviceCollectionVariable creating only 1 variable

  •  Checking on the Test collection properties, we can see that only 1 variable has been created

New-CMDeviceCollectionVariable creating only 1 variable

I’ve then decided to send my script to the other Dudes (aka Nick Pilon) to confirm the error. The big surprise was that he didn’t experienced the issue. His environment was R2 CU2 while mine was R2 CU3. I made another test on a separate R2 CU3 environment and the error was present.

Conclusion : the error only occurs in R2 CU3, it’s not present in R2 CU2.

I’ve opened a Microsoft Connect bug, feel free to upvote it here if you experience this issue.

New-CMDeviceCollectionVariable creating only 1 variable

Comments (0)