Jump to content
Sign in to follow this  
CAD4191

Need script for psexec \\computername -c test.bat

Recommended Posts

CAD4191

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.

Share this post


Link to post
Share on other sites
Pook

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.

Share this post


Link to post
Share on other sites
CAD4191

sorry this one is not working any other idea is highly appreciated.

Share this post


Link to post
Share on other sites
CAD4191

I solved the problem by myself I forgot to put space..:graduated:

Share this post


Link to post
Share on other sites
latoonne

My Function :graduated:

;===============================================================================

; 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

Share this post


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
Sign in to follow this  

×