@Alim Bhaluani Thanks for posting in our Q&A.
To clarify this issue, we appreciate your help to collect some information:
- Please make sure the Powershell script is deployed to the device successfully.
- Please check if the device is 64 bit. If yes, please set "Run script in 64 bit PowerShell Host" to "Yes" in the Powershell script.
- Make sure the device is Azure AD joined, not Azure AD registered.
- From your description, did you mean that the setting "Run this script using the logged on credentials" is set to "No"?
If yes, is it successful when you use the local system account to run the Powershell script?
If there is anything update or any misunderstanding, feel free to let us know.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
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.