(the last part of the script contains more collections, but for the purpose of the problem this is enough).
If I run this script as it is, I've the following error:
Add-CMDeviceCollectionDirectMembershipRule : Cannot validate argument on parameter 'ResourceId'. The argument is null or empty. Supply an
argument that is not null or empty and then try the command again.
If I wait a couple of seconds and I run the script again, with the same variables, the script runs without any issues. If I add "Start-Sleep -Seconds 30" before the adding the computer to the collection, the script also runs without issues. I'm assuming that I need to give time to ConfigMgr to refresh the data? Question: Is it possible to force this (refresh)? Does anyone had this before?
Hi all,
I've created a simple powershell just to add a new device into ConfigMgr, plus add this same computer to more collections.
However, when I run the script there's a strange behavior.
Script:
$MAC = "00:29:15:80:4E:4A"
If I wait a couple of seconds and I run the script again, with the same variables, the script runs without any issues. If I add "Start-Sleep -Seconds 30" before the adding the computer to the collection, the script also runs without issues. I'm assuming that I need to give time to ConfigMgr to refresh the data? Question: Is it possible to force this (refresh)? Does anyone had this before?
Thank you in advanced!
Share this post
Link to post
Share on other sites