Jump to content

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


Recommended Posts

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

  • 2 weeks later...

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

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