Jump to content

Run Shellexecute as another user


Recommended Posts

I have users that need to run ipconfig to release and/or renew and lack authority in XP. What I think I want to do is create a special local user that can change Network Configuration, then create an Autoit script which runs Shellexecute as this user to do the ipconfig commands - then compile the script to create an executable to hide any user and password that may be in the script.

How to I set the authority to the special local user? The Shellexecute part looks easy but I am unsure how I do it as a "RnunAs".

Link to comment
Share on other sites

I mean "Run As"

Hi!

In command prompt type:

>runas /user:administrator "mmc gpedit.msc"

That example would open up group policy editor. Anything with a .msc extension needs mmc in front of it to work. exe's (such as cmd.exe) don't need mmc in front of it. Quotes are also important.

Cheers!

Link to comment
Share on other sites

I mean "Run As"

Hi!

In command prompt type:

>runas /user:administrator "mmc gpedit.msc"

That example would open up group policy editor. Anything with a .msc extension needs mmc in front of it to work. exe's (such as cmd.exe) don't need mmc in front of it. Quotes are also important.

Cheers!

Link to comment
Share on other sites

Hi!

In command prompt type:

>runas /user:administrator "mmc gpedit.msc"

That example would open up group policy editor. Anything with a .msc extension needs mmc in front of it to work. exe's (such as cmd.exe) don't need mmc in front of it. Quotes are also important.

Cheers!

What I rreally want to do is imbed the "runas" in the script so regular users cannot see that it is a special user.

Link to comment
Share on other sites

What I rreally want to do is imbed the "runas" in the script so regular users cannot see that it is a special user.

You could use the below script to do what you want. I've used something similar before on my Silent LogMeIn Free script.

CODE
$Username =

$Domain = ; You can put @LogonDomain here if domain users or if using an system account use @ComputerName

$Password =

RunAsWait($Username ,$Domain ,$Password , 2, "cmd.exe /c ipconfig /release", @SystemDir, @SW_HIDE)

RunAsWait($Username ,$Domain ,$Password , 2, "cmd.exe /c ipconfig /renew", @SystemDir, @SW_HIDE)

The above script will run an renew on thier ip address with all the command prompt boxes hidden

Edited by lostangel556
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...