Run Powershell script without being logged in


I have a scheduled task to run a powershell script on a Win 2019 server to export documents changed in last day. I use Get-PWDocumentsBySearchWithReturnColumns start and end dates then Export-PWDocuments to accomplish this. 

However I have only been successful in running it when the user is logged "on".

I have tried "Run whether user logged on or not", "Run with Highest Privileges" and have the following switches on the executable -executionpolicy bypass -noninteractive -File "C:\MyScript.ps1"

Not sure if this is due to the PW search that will only run in a "logged on" user instance? When logged on runs fine.

Any input would be appreciated, thanks