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