Import-CMComputerInformation cmdlet is not working in ConfigMgr 2012 SP1
When I was writing a script to import computer information for use with OSD, I stumpled upon a problem. The command I was trying to run was something like:
$CollectionName = "All Windows Server 2012" Import-CMComputerInformation -ComputerName "TEST01" -MacAddress 00:00:00:00:00:00 -CollectionName $CollectionName
When I ran this command line, the cmdlet would return this warning message every time:
WARNING: The collection All Windows Server 2012 does not exist or is not suitable for adding the new device.
I thought that my script was providing the parameter CollectionName wrong, so I changed it to:
[string]$CollectionName = "All Windows Server 2012" Import-CMComputerInformation -ComputerName "TEST01" -MacAddress 00:00:00:00:00:00 -CollectionName $CollectionName
Even this way of providing the CollectionName parameter failed with the same error as above. So I tried the following:
Import-CMComputerInformation -ComputerName "TEST01" -MacAddress 00:00:00:00:00:00 -CollectionName "All Windows Server 2012"
Oddly, the same warning message appeared. What’s going on?
Luckliy, Microsoft has released a Cumulative Update 1 for System Center 2012 Configuration Manager SP1. You can download it here: http://support.microsoft.com/kb/2817245
If you scroll down a bit in the More Information part, you see the following:
When the Import-CMComputerInformation -CollectionName “All Systems” -ComputerName “Computer01” -MacAddress “xx:xx:xx:xx:xx:xx” command is run, the command is unsuccessful. Additionally, you receive the following error message: WARNING: The collection All Systems does not exist or is not suitable for adding the new device.
If you install the CU1, and run the command again you’ll be surprised to see that the same error message appears again. And then you’d think “but I installed the update?”. Well the reason is that the updated cmdlets are installed with the Console update (msp file located at C:\Program Files\Microsoft Configuration Manager\hotfix\KB2817245\AdminConsole\i386). In order to install this update, open a command prompt as an administrator, browse to the folder and run the following command:
msiexec /p configmgr2012adminui-sp1-kb2817245-i386.msp /l*v C:\temp\adminupdate.log
Once the update is installed, the Import-CMComputerInformation cmdlet will work as expected. See the picture below: