Jump to content

Recommended Posts

Posted (edited)

Hi folks

Ive been trying to knock up a little script to help me out in the mornings

Im working on a helpdesk and have a list of applications i need to have open, some which run as my basic user account then prompt for my admin details on their own & some of which need to be run as my admin account

So i have a script that pops up asks for a username and password of the elevated admin account runs the non esculated apps and then moves on to the esculated apps one of which is AD,

RunAs($sUserName, $sDomain, $sPassword, 0, "C:Program FilesExchsrvrbinusers and computers.msc")
While @error
         MsgBox(16, 'Error #' & @error, 'Error starting Active Directory console.')
WEnd

any method of calling AD directly results in error 1 being returned

calling it through cuing cmd or @Compsec result in a UAC prompt

I have read that AD, regedit etc are protected from virtual keyboard etc but does this comppletely prevent the msc console from being opened?

Thanks

Grant

Edited by Grantson
  • Moderators
Posted

Hi, Grantson. The code below works just fine for me. As you mentioned the UAC, I would suggest looking at #RequireAdmin in the helpfile.

ShellExecute(@SystemDir & "dsa.msc")

"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!

Posted

Thanks Jlogan

using #RequireAdmin wouldnt work, the script launches 8 apps 3 of which run on my standard login then 5 which require an admin login

i guess using shellexecute and having to fill in one uac box after starting the script and providing credentials is still an improvement over 8 manual logins

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
×
×
  • Create New...