Skip to content

Instantly share code, notes, and snippets.

@rytoj
Last active September 19, 2019 11:23
Show Gist options
  • Save rytoj/045c84acbf93b53dda0b to your computer and use it in GitHub Desktop.
Save rytoj/045c84acbf93b53dda0b to your computer and use it in GitHub Desktop.
@ECHO OFF
REM.-- Prepare the Command Processor
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
set psexec="\\192.168.22.252\tmp\psexec.exe"
set nircmd="\\192.168.22.252\tmp\nircmd.exe"
set user=administrator
set pass=password
set savedir="\\192.168.22.252\tmp\test.png"
set savedirstore="\\192.168.22.252\tmp\save\scr~$currdate.MM_dd_yyyy$-~$currtime.HH_mm_ss$.png"
set dirpath="%userprofile%/Desktop/tmp"
if not exist %dirpath% mkdir %dirpath%
IF not EXIST %dirpath%/nircmd.exe (
echo nircmd.exe is missing.
set missing=yes
)
IF not EXIST %dirpath%/PsExec.exe (
echo PsExec.exe is missing.
set missing=yes
)
IF "%missing%"=="yes" (
pause
)
echo Screen capture ver. 0.013
echo --------------
set /p UserInputPath=Enter hostname or IP adress:
:menuLOOP
echo.
echo.= Menu =================================================
echo.
for /f "tokens=1,2,* delims=_ " %%A in ('"findstr /b /c:":menu_" "%~f0""') do echo. %%B %%C
set choice=
echo.&set /p choice=Make a choice or hit ENTER to quit: ||GOTO:EOF
echo.&call:menu_%choice%
GOTO:menuLOOP
::-----------------------------------------------------------
:: menu functions follow below here
::-----------------------------------------------------------
:menu_1 2 savescreenshots
%psexec% \\%UserInputPath% -u %user% -p %pass% -i -c %nircmd% loop 2 3000 savescreenshot %savedir%
GOTO:EOF
:menu_2 Savescreenshot loop
:loop
%psexec% \\%UserInputPath% -u %user% -p %pass% -i -c %nircmd% savescreenshot %savedir%
echo %time%
timeout 3 > NUL
goto loop
GOTO:EOF
:menu_3 Save capture
set /p quantity=Screenshots count:
set /p time=Wait time (s):
%psexec% \\%UserInputPath% -u %user% -p %pass% -i -c %nircmd% loop %quantity% %time%000 savescreenshot %savedirstore%
GOTO:EOF
:menu_4 Remote System gpupdate
%psexec% \\%UserInputPath% -u %user% -p %pass% -i -c cmd /c C:\Windows\System32\gpupdate.exe
GOTO:EOF
:menu_5 Change IP or Hostname
set /p UserInputPath=Enter hostname or IP adress:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment