Hi. Thank you for your question and reaching out. I’d be more than happy to help you with your query.
The error message "Cannot bind argument to parameter 'ResourceId' because it is null" suggests that the script is trying to pass a null value to the 'ResourceId' parameter when running the Get-CMDevice cmdlet. This error occurs when the script is unable to find the device in the SCCM database that it is trying to add to the collection.
The issue could be caused due to a few reasons:
-The MID server does not have access to the SCCM environment. Make sure that the MID Server has access to the SCCM server and the necessary permissions to run the script.
-The device is not yet discovered by the SCCM environment. Make sure that the device is discovered by the SCCM environment before running the script.
-The resource name is not correct. Make sure that the resource name passed to the script is correct.
-The Cmdlet is not available on the MID server. Make sure that the SCCM client is installed on the MID server.
You can try the following steps to troubleshoot the issue:
- Verify that the MID Server has access to the SCCM server and that it has the necessary permissions to run the script.
- Check if the device is discovered by the SCCM environment.
- Verify that the resource name passed to the script is correct.
- Verify that the SCCM client is installed on the MID server.
- Try running the script on the SCCM machine to see if it runs without error.
- Check the logs on the SCCM server and MID server to see if there are any error messages or issues that may indicate the cause of the problem.
It's also worth checking the script and the parameters being passed, make sure that the script is passing the correct parameters and that the parameter is not null or empty.
If the script is running fine on the SCCM machine but not on the MID Server, it could be an issue with the environment. It's a good idea to check the SCCM and MID Server logs for more information about the error.
If the reply was helpful, please don’t forget to upvote or accept as answer, thank you.