Using ProcessAsUser question

Hi again,
I need your help because I might not be using ProcessAsUser the right way.
I have a few software (like 4 or 5) that cannot be deployed using SYSTEM account (we are deploying our software as an application using SCCM).
These deployment only occur once every 2 or 3 weeks on a few computers.
The workaround I’ve found is to use ProcessAsUser.
Currently, I’m:

  • Opening a session on the computer with my domain admin account
  • Manually launching the installation from Software Center where the PSADT install command-line is:
Execute-ProcessAsUser -UserName $person -Path  

and $person is my domain admin account.

I need to deploy a new soft to 100 computers and it doesn’t support SYSTEM account.
I want to avoid opening a session on those 100 computers with my account.

I have 2 questions:

  1. Can I use ProcessAsUser with an account that would not have an opened session on the computer?
  2. Can I specify a password for this account so that the task is planned with this account

I don’t know if this is clear enough and if this can be done.
I’m available if you need more explanation.
Thanks

Hi,
I’m still looking for an answer here.
Thanks

Hello,

the function does not currently support entering a password.
It creates a scheduled task under SYSTEM that runs whether or not the user is logged in.

System or the account specified if the session is already opened with it.
Do you think it could be added to a future version?

Well, if you dont specify a username then its the currently active user, yes.

Possibly in the v4 but not v3 since we plan to support windows 7 in v3, which comes with PS 2.0 which is very limited.

Thanks a lot luki1412.
I’ve deployed Management Framework 5.1 on all my W7 computers because I didn’t want to be bothered by unsupported PoSH commands.
Hopefully, we will get rid of all our W7 in a few months and we’ll finally be able leave in a better world :smiley:

1 Like

I’m also having issues using execute-processasuser. I am deploying script using SCCM so in SYSTEM context. Execute-processasuser works fine but ONLY if a User is logged on - if run on a computer with no user logged on I get the following error…

“The function [Execute-ProcessAsUser] has a -UserName parameter that has an empty default value because no logged in users were detected when the toolkit was launched.”

Command line used
Execute-ProcessAsUser -Path ‘C:\Program Files (x86)\anapp\anapp.exe’ -Wait -RunLevel LeastPrivilege

How best can I detect if a User is logged on? I tried detecting if the explorer.exe process was running but I get inconsistent results (sometimes no explorer.exe detected and I can skip processasuser but other times it is detected when no user is logged on and runs and script fails).

Thanks for help.