Hi,
Running scripts in the system user context can sometimes lead to issues.
Use tools like PsExec
to test running your script as the system account. This can help you identify any issues that might occur when the script runs in the system context:
PsExec.exe -s -i PowerShell.exe -File "C:\Path\To\YourScript.ps1"
This approach can help you troubleshoot and ensure that your script works as expected when run in the system context. If you encounter any specific errors or issues, feel free to share them for further assistance.