What is difference between these two commands RRS feed

  • Question

  • 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

    What is .ResourceID followed by () command.


    Friday, March 7, 2014 7:02 PM


All replies