Jump to content

Switch to Admin User context


Guest itdsys
 Share

Recommended Posts

We use a regular account for day to day operations, and have admin accounts for security functions (same log in with "adm" suffix). I got bothered by logging completely off (the run as... feature does not work on Windows Explorer) so I found a method on the internet for switching user context by closing the explorer process and reopening it. I then programmed that method into the attached script.

Change "OurDomain" to your domain name. I have found it VERY handy.

Tested on W2K and XP.

If anyone can tell me why ProcessClose("explorer.exe") doesn't work the second time around on an XP -- I would greatly appreciate it.

Lareen

Switch_to_Admin_User.au3

Link to comment
Share on other sites

Security issues. ProcessClose cannot close a process from another user with the same security as the original user. See the following metaphor:

x is run by user

x kills explorer that was started by user

x runs explorer with admin rights

x kills trys to kill explorer admin with user rights

can't possibly work.

What you can do is rerun your script in admin rights, then run explorer and kill explorer from your script in admin rights.

Who else would I be?
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...