-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from liyuan-teamlab/master
add close exe and copy script; add start script to run remote exe
- Loading branch information
Showing
5 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
param($session,$localPath,$remotePath,$exeName) | ||
|
||
|
||
Invoke-Command $session -ScriptBlock { | ||
param($remotePath, $exeName) | ||
$exeInstance = Get-Process $exeName -ErrorAction SilentlyContinue | ||
if ($exeInstance) | ||
{ | ||
Stop-Process -Name $exeName -Force | ||
Sleep 2 | ||
} | ||
if(Test-Path $remotePath) | ||
{ | ||
Remove-Item $remotePath -Recurse | ||
} | ||
} -ArgumentList ($remotePath, $exeName) | ||
Copy-Item -Recurse -ToSession $session -Path $localPath -Destination $remotePath |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
192.168.17.128 | ||
192.168.17.129 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@echo off | ||
For /f "tokens=1-3 delims=/ " %%a in ('date /t') do (set mydate=%%a-%%b-%%c) | ||
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a%%b) | ||
rem echo %mydate%_%mytime% | ||
|
||
set userName=YourWindowsUserName | ||
set password=YourWindowsPassword | ||
set workingDir=C:\ExeFolderInRemoteMachine | ||
set exePath=C:\ExeFolderInRemoteMachine\ExeToRun.exe | ||
rem log path is case sencitive | ||
set args=-logfile Log\%mydate%_%mytime%.log | ||
|
||
rem Remove following comment to run application | ||
rem .\PsExec64.exe -n 3 -d -i -h -w %workingDir% \\192.168.17.128 -u %userName% -p %password% %exePath% %args% | ||
rem change remote.txt for list of remote machine ip address | ||
.\PsExec64.exe -n 3 -d -i -h -w %workingDir% @remote.txt -u %userName% -p %password% %exePath% %args% | ||
pause |