Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

What is difference between these two commands

$
0
0

Command 1 - Add-CMDeviceCollectionDirectMembershipRule -CollectionName "Power Shell Test" -ResourceId $(Get-CMDevice -name client1).ResourceID

Command 2 - Add-CMDeviceCollectionDirectMembershipRule -CollectionName "Power Shell Test" -ResourceId $(Get-CMDevice -name client1).resourceID

Command 1 runs successfully and command 2 fails. Only difference is that .resourceID is typed with caps R and second command typed with small r .

I get the following error when running command 2

Add-CMDeviceCollectionDirectMembershipRule : Cannot validate argument on parameter 'ResourceId'. The argument is null or empty.
Provide an argument that is not null or empty, and then try the command again.
At line:1 char:91
+ ... t" -ResourceId $(Get-CMDevice -name client1).resourceID
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Add-CMDeviceCol...tMembershipRule], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ConfigurationManagement.Cmdlets.Collections.Commands.AddDevi
   ceCollectionDirectMembershipRuleCommand

What is .ResourceID followed by () command.

Thanks  


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>