Jump to content

Script to run cmd in system context to install exe's


Recommended Posts

Hi

I am trying to open cmd in system context using psexec.exe from the below vbscipt, I am successful. Looking to create au3 file for the same functionality

path="C:\Packs\Completed_Pkg\Setup\"

objShell.run "C:\Tools\temp\PsExec.exe -i -s cmd /c "& chr(34)&path&"Setup.exe"&chr(34)&" /Popup"

AU3File

----------

run("C:\Tools\temp\PsExec.exe -i -s cmd") unable to run this in autoit. Here it opens the cmd and closes immediately

But if i use run("C:\Tools\temp\PsExec.exe cmd") the script works and opens user context and for system context I need to pass "-i -s" for the psexec.exe.

Please help me how I can do this??Thanks in advance.

Link to comment
Share on other sites

Hi Sikkin,

Thanks for your reply,

But after running I got this error

"The file does not have a program associated with it for performing this action. Please install a program and if one already installed,create an association in the default programs control panel". The psexec.exe file is a standalone exe.

Thanks,

Venkat.

Edited by venki284
Link to comment
Share on other sites

  • Moderators

This runs a Setup.exe file as System for me:

$path="C:PacksCompleted_PkgSetup"
ShellExecute("PsExec.exe", '-i -s cmd /c "' & $path & 'Setup.exe" /Popup') ;PSExec in same dir as script.

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

Link to comment
Share on other sites

Hi Juviji,

It doesnt work either there's some syntax error while executing.Any other help..?

Thanks,

Venkat.

Did you compensate for the variables ? - chr(34)&path ? - Should be $chr(34)&$path and should be existing.

Link to comment
Share on other sites

Finally it worked for me!!! Hurray

Juviji is correct but the exe I should run as admin :guitar:

ShellExecuteWait("PsExec.exe"," -i -s cmd /c "& chr(34)&$path&"Setup.exe"&chr(34)&" /Popup","C:Toolstemp")

Thanks for all who helped me done this..I am posting another one soon wish you all give me same support.

Thanks,

Venkat.

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...