Hi folks. i've been trying to use the Add-CMDeviceCollectionDirectMembershipRule Powershell command to import one server into SCCM 2012 but keep getting errors. I searched online for a resolution with the error code, but am not finding a solution. Any guidance would be appreciated. I'm using the code below. Thanks
$x="node1234"
$collectionname="TEST"
Add-CMDeviceCollectionDirectMembershipRule -CollectionName $collectionname -ResourceId $(get-cmdevice -Name $x).ResourceID
ERROR BELOW:-
get-cmdevice : ConfigMgr Error Object:
instance of SMS_ExtendedStatus
{
Description = "Error retrieving object CollectionID=SMS00001";
ErrorCode = 2151811598;
File = "e:\\qfe\\nts\\sms\\siteserver\\sdk_provider\\smsprov\\sspcollection.cpp";
Line = 679;
ObjectInfo = "SMS_Collection";
Operation = "GetObject";
ParameterInfo = "SMS_Collection.CollectionID=\"SMS00001\"";
ProviderName = "ExtnProv";
StatusCode = 2147749890;
};
At line:1 char:127
+ ... -ResourceId $(get-cmdevice -Name $x).ResourceID
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Microsoft.Confi...etDeviceCommand:GetDeviceCommand) [Get-CMDevice], WqlQu
eryException
+ FullyQualifiedErrorId : UnhandledExeception,Microsoft.ConfigurationManagement.Cmdlets.Collections.Commands.GetDe
viceCommand
Add-CMDeviceCollectionDirectMembershipRule : Cannot validate argument on parameter 'ResourceId'. The argument is null
or empty. Supply an argument that is not null or empty and then try the command again.
At line:1 char:125
+ ... me -ResourceId $(get-cmdevice -Name $x).ResourceID
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Add-CMDeviceCol...tMembershipRule], ParameterBindingValidationExceptio
n
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ConfigurationManagement.Cmdlets.Collections.C
ommands.AddDeviceCollectionDirectMembershipRuleCommand