Advertisement
J2897

PsExec

Dec 31st, 2014
456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.15 KB | None | 0 0
  1. :: Released under the GNU General Public License version 3 by J2897.
  2.  
  3. @echo OFF
  4. pushd "%~dp0"
  5. goto start
  6.  
  7.     REM Run this on the remote machine to disable the "UAC Remote Restrictions"...
  8.     REM This will not disable the UAC. So use the "-h" option in PsExec if you want privilege elevation.
  9.     reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f
  10.  
  11. :start
  12. color 0A
  13. setlocal
  14. set "PSEXEC=%USERPROFILE%\Programs\Sysinternals Suite\psexec.exe"
  15.  
  16. call :credentials.bat
  17. cmdkey /add:"%COMPUTER%" /user:"%COMPUTER%\%NAME%" /pass:"%PASSWORD%"
  18. cmdkey /list
  19.  
  20. explorer "%FOLDER%"
  21. echo Type 'exit' to quit...
  22. "%PSEXEC%" -h "\\%COMPUTER%" cmd.exe
  23.  
  24. cmdkey /delete:"%COMPUTER%"
  25. cmdkey /list
  26.  
  27. endlocal
  28. popd
  29. echo.
  30. pause
  31. exit /b 0
  32.  
  33. REM You can delete these and put them in a separate file called "credentials.bat".
  34. REM You can then use that same file for other PS Tools too.
  35. REM Just remember to delete the colon (:) from line 15.
  36. :credentials.bat
  37. REM Set the remote computer credentials...
  38. set "COMPUTER=7x64-VM1"
  39. set "NAME=J2897"
  40. set "PASSWORD=abc123"
  41. set "FOLDER=\\%COMPUTER%\"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement