Jump to content

RunAs User from SYSTEM account


Recommended Posts

Hi,

is there a possibility to run a script from the SYSTEM account and show a window or a GUI in another account?

To give an example if I run the following script from the USERTEST account, then I see the notepad window.

RunAs(USERTEST, @ComputerName, USERPWTEST, 0, "notepad.exe", "", @SW_SHOWMAXIMIZED)

But if I run it from the SYSTEM account, and I am logged in as USERTEST then I don't see the notepad window. I only see a process notepad.exe run as USERTEST but no visible window.

(This is obviously only a very simple example for my problem, for my script I want to start the script really as the SYSTEM account but have something visible for the logged in user.)

Link to comment
Share on other sites

  • Moderators

If I need to run as System, I often do a fileinstall of PSEXEC, and throw it in the temp directory on the machine. PSEXEC has an option to run as system but interact with the desktop of the currently logged in user.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

First time I work with the SYSTEM account... So RunAs under the SYSTEM account is not able to interact with the desktop of the currently logged in user? Under no circumstances?

Thanks, for suggesting PSEXEC. I somehow thought that I would be able to have everything in one exe (Well but fileinstall is a nice workaround then). But seems that I have to use PSEXEC.

Edited by 12321
Link to comment
Share on other sites

  • Moderators

If I remember correctly, psexec creates a hidden service, which is the only way to get something to run as SYSTEM. You cannot just do a RunAs. If I am incorrect, I am sure someone will wander by and tell me so :)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

When I use following code and run it under the system account:

Run("PsExec.exe -s -accepteula -u USERTEST -p USERPWTEST -i notepad.exe")

Then it is still very 'user friendly', because following message pops up:

Capture.thumb.PNG.463b42f03e87948e03e3a9

 

I know it's a security measure... But is there any way around it?

Edited by 12321
Link to comment
Share on other sites

  • Moderators

What do you get when you click the Why does this happen link?

(Hint: Yes there is something you can do, and that link - along with Google - will show you) :)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...