CM 2012 R2 SP1 no CU (5.0.8239.1000), cmdlet library 5.00.8249.1128. :/
From: [email protected] [mailto:[email protected]] On Behalf Of Sean Pomeroy Sent: Wednesday, September 23, 2015 10:44 AM To: [email protected] Subject: Re: [mssms] New cmdlet library for configmgr Strange. I used you first example and it worked fine. What version of CM are you one? What version of the library is installed? I am on CM 2012 R2 RTM with cmdlet library 5.00.8249.1128 On Wed, Sep 23, 2015 at 11:26 AM Mote, Todd <[email protected]<mailto:[email protected]>> wrote: So I have a tool/script that adds resources to collections using direct membership rules by using Add-CMDeviceCollectionDirectMembershipRule. Been using it for quite some time, couple of years at least. Ever since the new cmdlet library hit, every time I run the script, it complains about “hey there’s a new library!!!!” so to shut that up I installed it. Now, this cmdlet doesn’t seem to work anymore. No matter which way I give it the collection and the resource, “No object corresponds to the specified parameters.” For example: PS AU5:\> $Resource = Get-CMDevice -Name mycomputer PS AU5:\> $collection = Get-CMCollection -Name mycollection PS AU5:\> Add-CMDeviceCollectionDirectMembershipRule -Collection $collection -Resource $Resource Add-CMDeviceCollectionDirectMembershipRule : No object corresponds to the specified parameters. At line:1 char:1 + Add-CMDeviceCollectionDirectMembershipRule -Collection $collection -Resource $Re ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:String) [Add-CMDeviceCol...tMembershipRule], ItemNotFoundException + FullyQualifiedErrorId : SessionStateException,Microsoft.ConfigurationManagement.Cmdlets.Collections.Commands.Add DeviceCollectionDirectMembershipRuleCommand Fails with “No object corresponds to the specified parameters.” Despite both $resource and $collection have the correct data in them. OK, so I try: $Resourceid = (Get-CMDevice -Name mycomputer).resourceid $collectionid=(Get-CMCollection -Name 'My Collection').collectionid Add-CMDeviceCollectionDirectMembershipRule -Collectionid $collectionid -Resourceid $Resourceid Same thing. “No object corresponds to the specified parameters.” So wondering about the InvalidArgument: (:String) part I look at the help. It says “Add-CMDeviceCollectionDirectMembershipRule -CollectionId <String> -ResourceId <Int32>” so I check $collectionid to make sure it’s a string and $resourceid to make sure it’s an integer. They are. So I finally try to just type it out PS AU5:\> Add-CMDeviceCollectionDirectMembershipRule -CollectionId ‘AU50024A’ -ResourceId 16784543 Add-CMDeviceCollectionDirectMembershipRule : No object corresponds to the specified parameters. At line:1 char:1 + Add-CMDeviceCollectionDirectMembershipRule -CollectionId ‘AU50024A’ -ResourceId 16 ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:String) [Add-CMDeviceCol...tMembershipRule], ItemNotFoundException + FullyQualifiedErrorId : SessionStateException,Microsoft.ConfigurationManagement.Cmdlets.Collections.Commands.Add DeviceCollectionDirectMembershipRuleCommand and same result. “No object corresponds to the specified parameters.” InvalidArgument: (:String) Anybody seen this or know what else I can do? Todd
