Forum Discussion

simoscon's avatar
simoscon
Copper Contributor
Dec 13, 2022

Proactive remediation script using the logged-on credentials not working as intended

Hello community,

We are facing an issue with proactive remediation scripts if we are running as logon user and not admin. We want to check hourly if onedrive is running and if its not to start it.

As we run the following as shown on the screenshot, we get the error that onedrive cannot run using administrator

$OneDriveProc = "C:\Program Files\Microsoft OneDrive\OneDrive.exe"
Start-Process -FilePath $OneDriveProc -ArgumentList "/background"

 

Proactive remediation scripts that need to run as administrator are working as intended, can anyone replicate and let us know the results?

Thanks 

Simos

  • rahuljindal-MVP's avatar
    rahuljindal-MVP
    Bronze Contributor
    Maybe creating a schedule task made to run at user logon will make more sense. FYI, ODfB service is already designed to start automatically as far as I know.

Resources