Jump to content

runas command , run a windows command as administrator with parameters


Recommended Posts

Muzaiyan the OP is trying to run this from a non-admin domain profile; essentially you cannot use that as you would not be able to run the script with:

#requireAdmin
IsAdmin
Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to post
Share on other sites

Did you try specifying the full path instead of just the program name with the cmd param?

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to post
Share on other sites
  • Developers

 ok now it opens a command window with the cursor at C:\Windows\System32\  and nothing happens

What should it do? (Can't test this on my setup)

What happens when you type the commandline manually like this: bitlockerwizardelev.exe " u" in the opened window?

You could also try this format:

Local $iPID = RunAs($sUserName, @ComputerName, $sPassword, 0, @comspec & ' /k bitlockerwizardelev.exe \ u', "", @SW_SHOWMAXIMIZED)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites

 

What should it do? (Can't test this on my setup)

What happens when you type the commandline manually like this: bitlockerwizardelev.exe " u" in the opened window?

You could also try this format:

Local $iPID = RunAs($sUserName, @ComputerName, $sPassword, 0, @comspec & ' /k bitlockerwizardelev.exe \ u', "", @SW_SHOWMAXIMIZED)

Ive only got one post left, its supposed to open a password reset screen for users to allow them to change their

bitlocker password

Link to post
Share on other sites
  • Developers

Ive only got one post left,

Should be OK now.

its supposed to open a password reset screen for users to allow them to change their

bitlocker password

So what happened with the other 2 questions? :)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites

Its hard to guess when we don't have all the information. Post the most recent script used inside autoit tags or using the code editor in the comment menu.

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to post
Share on other sites
  • Developers

doesnt work nothing happens , it runs from command prompt manually  but not from autoit script. any more ideas or has this got you all thinking :-)

The question was what happens when you manually run the command from the window opened by the script?

Just want to get confirmation that works too when running under different credential.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites

I doubt it's a bug in Autoit, instead its more or less debugging that hasn't been done :shifty:

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to post
Share on other sites

Local $iPID = RunAs($sUserName, @ComputerName, $sPassword, 0, 'bitlockerwizard.elev "\ u"', "", @SW_SHOWMAXIMIZED)

this code works fine but you should try this one:

Local $Program = "bitlockerwizardelev.exe"

Local $parms = '\ U'
Local $sUserName = ""
Local $sPassword = ""

; try all flags one by one
Local $flags = 0
;~ $flags = 1
;~ $flags = 2
;~ $flags = 4
If Not FileExists(@SystemDir & "\" & $Program) Then MsgBox(16, "(File Not Found)", "Please Check The Existance of file.")
Local $iPID = RunAs($sUserName, @ComputerName, $sPassword, $flags, @ComSpec & " /C " & $Program & " " & $parms, @SystemDir, @SW_SHOWMAXIMIZED)
If @error Then
    MsgBox(16, "ERROR: " & @error, "Process failed")
    If StringRight($Program, 4) <> ".exe" Then MsgBox(16, "", "Please make sure that file is an executable or use ShellExecute() function")
EndIf

 

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...