We have an executable that needs to run with command line parameters pointing it to the current user's profile. The executable takes a well known folder (ie. Documents folder) and redirects it to a cloud storage location.
When trying to create an executable package with %USERPROFILE%\Documents as a command line parameter while specifying the current user's account, it points to C:\windows\system32\config\systemprofile\Documents. I have created a batch file that runs the executable with the %USERPROFILE%\Documents as the parameter and it resolves correctly to the current user's profile, ie C:\Users\David\Documents.
The executable returns an error when run through a batch file as a scheduled task: "RedirectingError: The handle is invalid." If I open up a command prompt (as the current user, not elevated), the batch file runs (from the sdmcache folder) and the executable does what it is expected to do and the well known folder gets redirected out into the cloud.
I am testing this on a Windows 10 x64 v1607 with LDMS 2016.3 SU3. I've also tried it with the Architecture options set to System Architecture and 64-bit, both giving the same result
We need to have a task that we can advertise in Workspaces so that people can redirect their local storage out in the cloud. I have been testing this as a policy supported push, not through Workspaces.
Why would this work manually through a command prompt, but not as a scheduled task?