MicrosoftDocs / sccm-docs-powershell-ref

Configuration Manager PowerShell documentation public repo
https://docs.microsoft.com/powershell/sccm/configurationmanager/
Creative Commons Attribution 4.0 International
26 stars 61 forks source link

Warning "The specified resource Id '11111111' is of the wrong type #244

Closed jasminrueegger closed 2 years ago

jasminrueegger commented 2 years ago

[Enter feedback here] Since updating Configuration Manager to 2107, adding a DirectMembershipRule with a Resource-Object generates a Warning and does not add the rule. Adding with ResourceID parameter works.

Warning: Add-CMDeviceCollectionDirectMembershipRule -CollectionId $collectionid -Resource (Get-CMDevice -name 'TestPC')

Still working: Add-CMDeviceCollectionDirectMembershipRule -CollectionId $collectionid -ResourceId (Get-CMDevice -name 'TestPC').ResourceId


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

aczechowski commented 2 years ago

Thanks @jasminrueegger for taking the time to share this with the Configuration Manager documentation team. I’m sorry that you’re having problems, and I want to make sure it gets to the right people that can help. There are a couple of options available to provide the best level of support for this:

I recommend including additional information on your issue when you report it, for more info see https://docs.microsoft.com/powershell/sccm/overview#feedback-for-powershell

I'm closing this issue as there's nothing actionable for docs at this time.

I wasn't able to reproduce the warning that you mentioned, using the same command. My site is now version 2111, so it's possible something changed, but I don't know of any bugs in this area that were fixed for 2111. One thing you might want to check is using the Resource parameter with the Get-CMDevice cmdlet. Maybe try using the Get-CMResource cmdlet, or also include the Resource parameter with the Get-CMDevice cmdlet. There are subtle differences with those cmdlets that might impact how the object is used with this collection membership rule cmdlet.

aczechowski commented 2 years ago

LOL...I just saw this in the 2111 release notes:

Fixed an issue when adding a rule by resource object.

So ignore my previous comment! I should have double-checked the release notes first instead of relying on my memory. So update to version 2111 to resolve the issue!

jasminrueegger commented 2 years ago

Thanks Aaron

We solved it already when I posted by using get-cmdevice. But I thought it a good idea to include this warning in the docs. Especially, since it prevents the resource from being added to the collection. But now that it is solved, this will not be necessary.

Have a great day Jasmin


From: Aaron Czechowski @.> Sent: Wednesday, December 29, 2021 2:29 AM To: MicrosoftDocs/sccm-docs-powershell-ref @.> Cc: Jasmin Rueegger @.>; Mention @.> Subject: Re: [MicrosoftDocs/sccm-docs-powershell-ref] Warning "The specified resource Id '11111111' is of the wrong type (Issue #244)

LOL...I just saw this in the 2111 release noteshttps://docs.microsoft.com/powershell/sccm/2111-release-notes#add-cmdevicecollectiondirectmembershiprule:

Fixed an issue when adding a rule by resource object.

So ignore my previous comment! I should have double-checked the release notes first instead of relying on my memory. So update to version 2111 to resolve the issue!

— Reply to this email directly, view it on GitHubhttps://github.com/MicrosoftDocs/sccm-docs-powershell-ref/issues/244#issuecomment-1002353122, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGIJKZSR7SFQYIVEV6N4GADUTJQADANCNFSM5ISZYSYQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.Message ID: @.***>