@Thomas Reddy Thanks for posting in our Q&A.
For this issue, running the script on the client as an admin successfully doesn't mean that it will work when you deploy the script via intune.
It is suggested to try to run the script in the System account using the psexec tool. If it works well, we can deploy the script via intune. Here are the steps:
1.Install PsExec
https://learn.microsoft.com/en-us/sysinternals/downloads/psexec
2.Copy PsExec.exe to C:\Windows\System32
3.Open Powershell as admin and run the following command:
PsExec.exe -s -i powershell.exe
4.Then run the script in the new PowerShell windows.
If there is anything update, 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.