itye1970 Posted August 20, 2014 Posted August 20, 2014 (edited) i need to run a program whilst a user is logged on who is not a local administartor. I need to pass parameters to this program EG : How can I run C:\Windows\System32\program.exe u as local adminisatrator I need to compile the script as an .exe, note there are spaces in the above command also. I have searched through help and looked at using cmdline but this doesnt work. If I run a program for example C:\Windows\System32\calc.exe with no arguments it runs fine but as soon as i want to pass argunments to the program it does not run Many Thanks Edited August 20, 2014 by itye1970
MikahS Posted August 20, 2014 Posted August 20, 2014 Welcome to the Autoit Forums Can you post your script so that we may have a look? Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy 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
itye1970 Posted August 20, 2014 Author Posted August 20, 2014 Example() Func Example() ; Change the username and password to the appropriate values for your system. Local $sUserName = "admin" Local $sPassword = "apassword" RunAs($sUserName, @ComputerName, $sPassword, 0, $iPID, "C:\Windows\System32\bitlockerwizardelev.exe u", @SW_SHOWMAXIMIZED) WinWait("[CLASS:Notepad]", "", 10) ; Wait for 2 seconds. Sleep(20000) ;ProcessClose($iPID) EndFunc ;==>Example
itye1970 Posted August 20, 2014 Author Posted August 20, 2014 sorry is this one Example() Func Example() ; Change the username and password to the appropriate values for your system. Local $sUserName = "admin" Local $sPassword = "anypassword" Local $iPID = RunAs($sUserName, @ComputerName, $sPassword, 0, "bitlockerwizard.elev u", "", @SW_SHOWMAXIMIZED) ; Wait 10 seconds for the Notepad window to appear. WinWait("[CLASS:Notepad]", "", 10) ; Wait for 2 seconds. Sleep(2000) ProcessClose($iPID) EndFunc ;==>Example
Developers Jos Posted August 20, 2014 Developers Posted August 20, 2014 try: Local $iPID = RunAs($sUserName, @ComputerName, $sPassword, 0, 'bitlockerwizard.elev "\ 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.
itye1970 Posted August 20, 2014 Author Posted August 20, 2014 :-( still no luck. If i go to windows command prompt and type in C:\Windows\System32\bitlockerwizardelev.exe u , it works fine but still not working with autoit Example() Func Example() ; Change the username and password to the appropriate values for your system. Local $sUserName = "123" Local $sPassword = "123" ; Run Notepad with the window maximized. Notepad is run under the user previously specified. ;Local $iPID = RunAs($sUserName, @ComputerName, $sPassword, 0, "calc.exe", "", @SW_SHOWMAXIMIZED) Local $iPID = RunAs($sUserName, @ComputerName, $sPassword, 0, 'bitlockerwizard.elev " u"', "", @SW_SHOWMAXIMIZED) ; Wait 10 seconds for the Notepad window to appear. WinWait("[CLASS:Notepad]", "", 10) ; Wait for 2 seconds. Sleep(2000) ; Close the Notepad process using the PID returned by RunAs. ProcessClose($iPID) EndFunc ;==>Example
MikahS Posted August 20, 2014 Posted August 20, 2014 (edited) Example() Func Example() ; Change the username and password to the appropriate values for your system. Local $sUserName = "admin" Local $sPassword = "anypassword" Local $iPID = RunAs($sUserName, @ComputerName, $sPassword, 0,'bitlockerwizard.elev "\ u"', "", @SW_SHOWMAXIMIZED) sleep(2000) ProcessClose($iPID) EndFunc ;==>Example EDIT: Didn't see Jos' reply, this is the same thing Edited August 20, 2014 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy 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
MikahS Posted August 20, 2014 Posted August 20, 2014 (edited) slow down, it seems you are throwing things at the problem, which will not help. Give a try to the script provided in my post #7 and tell us if it works or not Edited August 20, 2014 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy 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
Developers Jos Posted August 20, 2014 Developers Posted August 20, 2014 :-( still no luck. If i go to windows command prompt and type in C:\Windows\System32\bitlockerwizardelev.exe u , it works fine but still not working with autoit Why is the no space in this line in u and in your script you have a space? 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.
MikahS Posted August 20, 2014 Posted August 20, 2014 Why is the no space in this line in u and in your script you have a space? Jos This could be why your script is not working Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy 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
itye1970 Posted August 20, 2014 Author Posted August 20, 2014 (edited) sorry its odd i know but it needs the space, the command from the windows prompt is c:windowssystem32bitlockerwizardelev.exe u Its the bitlocker reset password screen, for some reason microsoft decided to have a space in this command the space needs to be there , otherwise it wont work. Edited August 20, 2014 by itye1970
MikahS Posted August 20, 2014 Posted August 20, 2014 Alright, so did you give the script provided in post #7 a try? If so, what were the results? Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy 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
Developers Jos Posted August 20, 2014 Developers Posted August 20, 2014 sorry its odd i know but it needs the space, the command from the windows prompt is c:windowssystem32bitlockerwizardelev.exe u Its the bitlocker reset password screen, for some reason microsoft decided to have a space in this command the space needs to be there , otherwise it wont work. Ok, then the next question: Why is the programname different in the script? So you want: Local $iPID = RunAs($sUserName, @ComputerName, $sPassword, 0, '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.
itye1970 Posted August 20, 2014 Author Posted August 20, 2014 i tried post 7 and nothing happens. there was a typing mistake earlier the command does need a space it should be bitlockerwizardelev.exe u this is in the windowssystem32 directory
MikahS Posted August 20, 2014 Posted August 20, 2014 Replace the line in your script with Jos' from post #13 Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy 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
itye1970 Posted August 20, 2014 Author Posted August 20, 2014 did that but nothing appears Example() Func Example() ; Change the username and password to the appropriate values for your system. Local $sUserName = "username" Local $sPassword = "password" Local $iPID = RunAs($sUserName, @ComputerName, $sPassword, 0, 'bitlockerwizardelev.exe " u"', "", @SW_SHOWMAXIMIZED) sleep(2000) ProcessClose($iPID) EndFunc ;==>Example
Developers Jos Posted August 20, 2014 Developers Posted August 20, 2014 Try this so the CMD window stays open and remove the Processclose() 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.
itye1970 Posted August 20, 2014 Author Posted August 20, 2014 ok now it opens a command window with the cursor at C:\Windows\System32\ and nothing happens
Muzaiyan Posted August 20, 2014 Posted August 20, 2014 did you try that #RequireAdmin direct from example #include <MsgBoxConstants.au3> #RequireAdmin If IsAdmin() Then MsgBox($MB_SYSTEMMODAL, "", "The script is running with admin rights.") build .exe of your program and run your C:windowssystem32????? with u parameter or what ever.
Muzaiyan Posted August 20, 2014 Posted August 20, 2014 try also _RunDos() direct from example: #include <Process.au3> Local $rc = _RunDos("start Http://www.autoitscript.com") run your program on DOS prompt
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now