MSEndpointMgr

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: https://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:

Nickolaj Andersen

Chief Technical Architect and Enterprise Mobility MVP since 2016. Nickolaj has been in the IT industry for the past 10 years specializing in Enterprise Mobility and Security, Windows devices and deployments including automation. Awarded as PowerShell Hero in 2015 by the community for his script and tools contributions. Creator of ConfigMgr Prerequisites Tool, ConfigMgr OSD FrontEnd, ConfigMgr WebService to name a few. Frequent speaker at conferences such as Microsoft Ignite, NIC Conference and IT/Dev Connections including nordic user groups.

2 comments

  • I’ve gotten this cmdlet to work by installing CU1, however, I want to use the method of importing computer information via CSV file. My CSV file contains one column of computer names and one column of MAC addresses. Each time I try to import the CSV file using the Import-CMComputerInformation cmdlet, I get an error saying that the MAC address I provide isn’t a correctly formatted GUID.
    Is there anyway to format the CSV file so that the cmdlet knows I’m trying to feed it MAC addresses instead of GUIDs?

    • Hi Ben,
      I’m not sure what’s going wrong on your end, but I just tried this in my lab environment:
      $Collection = “Test”
      $Computers = Import-Csv C:\Temp\computers.csv
      $Computers | ForEach-Object {
      Import-CMComputerInformation -ComputerName $_.Name -MacAddress $_.MAC -CollectionName $Collection
      }
      After I updated membership for the “All Systems” collection, and then the “Test” collection the system got added.
      The CSV I used looks like:
      Name,MAC
      TEST01,00:00:00:00:00:01
      I hope this helps!
      Regards,
      Nickolaj

Sponsors

Categories

MSEndpointMgr.com use cookies to ensure that we give you the best experience on our website.