Skip to content

Commit

Permalink
Merge pull request #2 from liyuan-teamlab/master
Browse files Browse the repository at this point in the history
add close exe and copy script; add start script to run remote exe
  • Loading branch information
fuqunaga authored Apr 15, 2019
2 parents 2d02f18 + f06555f commit 5799b23
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,6 @@ paket-files/

# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
*.pyc

!/Headquarters/StartAppBat/PsExec64.exe
17 changes: 17 additions & 0 deletions Headquarters/Scripts/CloseExeClearFolderAndCopyFolder.ps1
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 added Headquarters/StartAppBat/PsExec64.exe
Binary file not shown.
2 changes: 2 additions & 0 deletions Headquarters/StartAppBat/remote.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
192.168.17.128
192.168.17.129
17 changes: 17 additions & 0 deletions Headquarters/StartAppBat/start.bat
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

0 comments on commit 5799b23

Please sign in to comment.