CAD4191 Posted October 7, 2011 Share Posted October 7, 2011 Hi can anyone please teach me how to put a psexec -c command in autoit Im using this command manually all the time in the command line and i want to make a script using Autoit. this is the command that I enter all the time in the command prompt and it works fine but I want to transfer it to autoit. the command is psexec \\computername -c test.bat where the bat files is saved in my c:\scripts.Any idea is highly appreciated. Link to comment Share on other sites More sharing options...
Pook Posted October 7, 2011 Share Posted October 7, 2011 What I do is: (not 100% the same) Runwait ("C:\psexec \\" & $Hostname & " -u " & $Domain & $username & " -p " & $Pass & " cmd /c " & $Open_Script) Not sure if this will help. Link to comment Share on other sites More sharing options...
CAD4191 Posted October 11, 2011 Author Share Posted October 11, 2011 sorry this one is not working any other idea is highly appreciated. Link to comment Share on other sites More sharing options...
CAD4191 Posted October 21, 2011 Author Share Posted October 21, 2011 I solved the problem by myself I forgot to put space.. Link to comment Share on other sites More sharing options...
latoonne Posted October 25, 2011 Share Posted October 25, 2011 My Function ;=============================================================================== ; Function Name: _RemoteEXE ; Description:: Lancement application en mode remote ; Parameter(s): Message ; Requirement(s): AutoIt ; Return Value(s): Langue ;$sInterac = 1 interaction avec le bureau O mode console ;=============================================================================== func _RemoteEXE($scomputerName,$sDomain,$sUserName,$sPassword,$sCommand,$sInterac=0) FileInstall("c:\Autoit\Tools\psexec.exe",@WindowsDir & "\psexec.exe") $sRemoteCommand = "psexec /accepteula \\" & $scomputerName & " -u " & $sDomain & "\"& $sUserName & " -p " & $sPassword & chr(32) & $sCommand ;InputBox(0,"",$sRemoteCommand) ;Exit if $sInterac = 1 then $sRemoteCommand = "psexec /accepteula \\" & $scomputerName & " -u " & $sDomain & "\"& $sUserName & " -p " & $sPassword & chr(32) & " -i " & $sCommand RunAsWait($sUserName, $sDomain, $sPassword, 2, @comspec & " /C " & $sRemoteCommand,@SystemDir,@SW_HIDE) EndFunc Link to comment Share on other sites More sharing options...
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