I´m trying to deploy a powershell script through scheduled tasks on a win7 system. I wan´t to create the task via group policy, so that on a specific date, software will be deployed.
The problem is, i wan´t the installation routine to be interactive, as long as a user is logged in. These user are NOT local administrators. But if i use “NT AUTHORITY/SYSTEM” as user for the task, i always get a silent installation.
I guess i have to use “Execute-ProcessAsUser”, but i´m not sure how excatly is should use it. “Execute-ProcessAsUser -Path [path to deploy application]” doesn´t work. Nothing happens.
You can’t use a toolkit function outside of the script engine. What you need to do is to break out of session 0 (system user context) when launching the Windows process. It’s been described and discussed in a couple of threads here and elsewhere.
Basically you need to start the process with ServiceUI.exe (found originally in MDT). I’ve had some success with this, but my experience has been that it’s not flawless enough to implement as a routine. Anyway, you might get better results. Once you have a copy of ServiceUI, create a batch / cmd file and add the following to it:
Try it out and see if it works in your environment. My testing went really well, but once it was deployed to my 500+ users, multiple mishappenings were described and I had quite a few unhappy users :)… So handle with care.
One more note: Execute-ProcessAsUser would not help you since this would (as the name of the function sugggests) execute the process as the logged in user. You mention yourself that your users aren’t local admins, so the process would not be able to elevate.