Jump to content
Sign in to follow this  
CrouchingHippo

Calling msc via admin account

Recommended Posts

CrouchingHippo

Hi All newbie needing dunce cap here

I have been trying to run diskmgmt.msc via a local admin account,so that non admins can do some disk stuff.

I couldn't get "msc" called, using ShellExecute within the file,

Local $sUserName = "adm_local"

Local $sPassword = "123"

local $sProgramm = ShellExecute("diskmgmt.msc")

RunAs($sUserName, @ComputerName, $sPassword, 0, $sProgramm, @ComSpec)

It didn't work.

So I tried creating an exe file with

ShellExecute("diskmgmt.msc")

and called it disk.exe and it works correctly.

So applying no knowledge at all I tried

Local $sUserName = "adm_local"

Local $sPassword = "123"

local $sProgramm = ShellExecute("disk.exe")

RunAs($sUserName, @ComputerName, $sPassword, 0, $sProgramm, @ComSpec)

I have no output on the screen.

(after copying disk.exe into system folder.)

I know I must be doing it wrong so please be gentle.

Thanks in advance

CH

Share this post


Link to post
Share on other sites
Talder

Hi,

Use it like this:

Local $sUserName = "administrator" 
Local $sPassword = "blabla" 
local $sProgramm = "mmc diskmgmt.msc" 
RunAs($sUserName,@ComputerName,$sPassword,0,$sProgramm)

Make sure your user has the right permission, otherwise you will see nothing happen :D

Bye,

Tim

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.