-1

I try to import a computer to SCCM with the cmdlet "Import-CMComputerInformation" (https://technet.microsoft.com/en-us/library/jj821991(v=sc.20).aspx), using

Import-CMComputerInformation -CollectionName "All Systems" -ComputerName "Computer1" -MacAddress "FA:FA:FA:FA:FA:FA"

Also tried with

Import-CMComputerInformation -ComputerName "Computer1" -MacAddress "FA:FA:FA:FA:FA:FA"

But I get this error

Import-CMComputerInformation : No object corresponds to the specified parameters.
At line:1 char:1
+ Import-CMComputerInformation -ComputerName "Computer1" -MacAddress "FA:FA:FA:FA:FA:FA"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Confi...ormationCommand:ImportComputerInformationCommand) [Import-CMComputerInformation], ItemNotFoundException
    + FullyQualifiedErrorId : ItemNotFound,Microsoft.ConfigurationManagement.Cmdlets.Oob.Commands.ImportComputerInformationCommand

This command also gives no output:

Get-CMDeviceCollection -Name "All Systems"

I am able to query certain other collections (our IT is divided in departments, you don't have permissions on everything). If I try to add a computer with the SCCM console, I am able to import a computer to All Systems, but I can also not find the All Systems-collection if I search for it.

Using WMI, comparable to this:

#New computer account information
$WMIConnection = ([WMIClass]"\\SERVER100\root\SMS\Site_PRI:SMS_Site")
    $NewEntry = $WMIConnection.psbase.GetMethodParameters("ImportMachineEntry")
    $NewEntry.MACAddress = $MACAddress
    $NewEntry.NetbiosName = $ResourceName
    $NewEntry.OverwriteExistingRecord = $True
$Resource = $WMIConnection.psbase.InvokeMethod("ImportMachineEntry",$NewEntry,$null)

I am able to import it.

A PC seems to move to certain collections after importing, defined by rules.

Is there a way to use the Import-CMComputerInformation command? It seems a bit silly to write your own function if there's a perfectly fine cmdlet already. I'd also rather not write it directly to a certain collection, as those rules might possibly change, and it -should- be possible to import it to All Systems.

SCCM is managed by a central IT, we are a decentral and use their infrastructure (in this case). That means we don't have full access to SCCM. We wanted a more automated way to import computers, and they wouldn't adjust their import-tools to accept command line arguments, so I decided to write my own import-tool.

EDIT, verbose output:

PS L01:\> Import-CMComputerInformation -ComputerName $pcName -MacAddress $macAddress -Verbose
Import-CMComputerInformation : No object corresponds to the specified parameters.
At line:1 char:1
+ Import-CMComputerInformation -ComputerName $pcName -MacAddress $macAddress -Verb ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Confi...ormationCommand:ImportComputerInformationCommand) [Import-CMComputerInformation], ItemNotFoundException
    + FullyQualifiedErrorId : ItemNotFound,Microsoft.ConfigurationManagement.Cmdlets.Oob.Commands.ImportComputerInformationCommand


PS L01:\> $macAddress
98:90:96:AE:64:97

PS L01:\> $pcName
SET-D-DI-00804

1 Answers1

0

First, all your PowerShell lines above work without problem. The only reason I can think about is that you said:"our IT is divided in departments, you don't have permissions on everything". So this can be a problem with your permission. You can work within console does not mean that you can do via PowerShell, there are different permission needed. A way to test is to do via a full administrator account.

Second, Import-CMComputerInformation cmdlet is good to use without problem. One thing need to mention is that after you run the cmdlet, the device information will first get imported into Devices but not All Systems or any other collection you specified in the command. After collection membership evaluation, it will then appear in All Systems and any other collection. Just search around the web, you'll find may way around this issue.

So I would suggest that you can talk to your central IT and ask him to give you proper permission to perform actions which you should be able to do including this issue you asked here.

  • I realise that it is a permission issue, but what is the difference between the cmdlet and the wmi function? – Terror Factor Feb 03 '17 at 06:57
  • If you use -verbose behind the cmdlet, you'll see what it's trying to do. There should be WMI Query or method, then you can execute each manual to see if any difference. – Bifeng Dong - MSFT Feb 03 '17 at 08:09
  • I've updated the beginpost with the verbose output – Terror Factor Feb 03 '17 at 09:55
  • I mean when you do it via cmdlet, there was execution of WQL Query: SELECT * FROM SMS_Collection WHERE CollectionTye = 2 AND CollectionID = '*******'. This is the difference with when doing it via WMI function. You can try to execute this query, I believe it will return the same error. This is the account permission issue. – Bifeng Dong - MSFT Feb 03 '17 at 11:00
  • Just want to know how is the issue now? Is the information useful? – Bifeng Dong - MSFT Feb 26 '17 at 14:08