We were able to figure this out.
While using above cmdlet, device wasn't in limit collection.
Once we solved it, the cmdlet was being executed fine.
Powershell cmdlet for SCCM throwing error when executing from ServiceNow but working directly from SCCM server
cmdlet: Add-CMDeviceCollectionDirectMembershipRule -CollectionId $CollectionID -ResourceId $rid
When I run above cmdlet from ServiceNow, it gives error: "The specified resource Id '12345678' is of the wrong type."
But when I run the same cmdlet directly against SCCM, it adds resource successfully to collection.
Troubleshooting done:
Tried storing resource id as [int] and [string] both, but it still gave above error.
Any idea what can be causing this?
2 answers
Sort by: Newest
-
Mudit 101 Reputation points
2021-03-26T14:34:20.303+00:00 -
Fiona Yan-MSFT 2,311 Reputation points
2020-10-28T07:56:23.883+00:00 @muditbahedia
Thank you for posting in Microsoft Q&A forum.
From your description, your question is more trend towards to the servicenow direction.We believe that the support engineer of the servicenow may have more resource to help us with our issue.I suggest you to the servicenow community so that engineer of servicenow will help you solve this issue in a more efficient way. Thank you for your understanding.
To obtain the path of servicenow community,please take a look at the web site listed below:
https://community.servicenow.com/communityThank you very much for your kind understanding.
Have a nice day!
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.