View the source after the break
You'll need to build a directory structure like this
- Your root folder in script header
- UltraVNC
- winvnc.exe; ultravnc.ini; vnchooks.dll
- TightVNC
- tvnserver.exe; screenhooks32.dll
- PSTools
- All the files from PSTools.
You also need to run PSExec and PSKill from the command line first to accept the license agreements, as the user you will run the script as, or it wont work
@echo off color 11 title remote support set host=%COMPUTERNAME% set src_directory=\\Your_directory_here_without_final_slash SET admin_user=Your_Domain_Admin_User cls echo Enter the Administrator password set /p password="password:" goto start :start cls echo Welcome, %USERNAME% set /p machine="Enter the machine you wish to support:" goto supportType :supportType cls echo What type of support do you want to offer? echo. echo 1. Start WINVNC (Windows 7) echo 2. Start WINVNC (Windows XP) echo 3. start Remote Assistance echo 4. Start tightVNC echo 5. Start WINVNC and CMD echo 8. stop all echo 9. change machine echo. echo 0. Quit echo. echo host: %COMPUTERNAME% echo remote: %machine% echo. set /p choice="Enter your choice: " if "%choice%"=="1" goto WINVNC if "%choice%"=="2" goto WINVNCXP if "%choice%"=="3" goto MSRA if "%choice%"=="4" goto TIGHTVNC if "%choice%"=="5" goto VNCandCMD if "%choice%"=="8" goto stopall if "%choice%"=="9" goto start if "%choice%"=="0" goto quit echo Invalid choice: %choice% echo. pause goto supportType :WINVNC cls mkdir \\%machine%\C$\VNC2\ mkdir \\%machine%\C$\VNC2\UltraVNC\ echo %src_directory%\UltraVNC\winvnc.exe \\%machine%\C$\VNC2\UltraVNC copy %src_directory%\UltraVNC\winvnc.exe \\%machine%\C$\VNC2\UltraVNC copy %src_directory%\UltraVNC\ultravnc.ini \\%machine%\C$\VNC2\UltraVNC copy %src_directory%\UltraVNC\vnchooks.dll \\%machine%\C$\VNC2\UltraVNC REM Run the listener on the admin PC (your one) %src_directory%\PSTools\PsExec \\%COMPUTERNAME% -i -d %src_directory%\UltraVNC\vncviewer.exe -listen REM run the viewer on the remote machine and connect back to yours. %src_directory%\PSTools\PsExec \\%machine% -u %admin_user% -p %password% -i 1 -d C:\VNC2\UltraVNC\winvnc.exe -connect %COMPUTERNAME% -run pause goto supportType :WINVNCXP cls mkdir \\%machine%\C$\VNC2\ mkdir \\%machine%\C$\VNC2\UltraVNC\ copy %src_directory%\UltraVNC\winvnc.exe \\%machine%\C$\VNC2\UltraVNC copy %src_directory%\UltraVNC\ultravnc.ini \\%machine%\C$\VNC2\UltraVNC copy %src_directory%\UltraVNC\vnchooks.dll \\%machine%\C$\VNC2\UltraVNC REM Run the listener on the admin PC %src_directory%\PSTools\PsExec \\%COMPUTERNAME% -i -d %src_directory%\UltraVNC\vncviewer.exe -listen %src_directory%\PSTools\PsExec \\%machine% -u %admin_user% -p %password% -i -d C:\VNC2\UltraVNC\winvnc.exe -connect %COMPUTERNAME% -run pause goto supportType :TIGHTVNC cls mkdir \\%machine%\C$\VNC2\ mkdir \\%machine%\C$\VNC2\TightVNC\ copy %src_directory%\TightVNC\tvnserver.exe \\%machine%\C$\VNC2\TightVNC copy %src_directory%\TightVNC\screenhooks32.dll \\%machine%\C$\VNC2\TightVNC REM Run the listener on the admin PC %src_directory%\PSTools\PsExec \\%COMPUTERNAME% -i -d %src_directory%\TightVNC\tvnviewer.exe -listen %src_directory%\PSTools\PsExec \\%machine% -i -d C:\VNC2\TightVNC\tvnserver.exe -controlapp -connect %COMPUTERNAME% echo. pause goto supportType :VNCandCMD cls mkdir \\%machine%\C$\VNC2\ mkdir \\%machine%\C$\VNC2\UltraVNC\ copy %src_directory%\UltraVNC\winvnc.exe \\%machine%\C$\VNC2\UltraVNC copy %src_directory%\UltraVNC\ultravnc.ini \\%machine%\C$\VNC2\UltraVNC copy %src_directory%\UltraVNC\vnchooks.dll \\%machine%\C$\VNC2\UltraVNC REM Run the listener on the admin PC %src_directory%\PSTools\PsExec \\%COMPUTERNAME% -i -d %src_directory%\UltraVNC\vncviewer.exe -listen %src_directory%\PSTools\PsExec \\%machine% -u %admin_user% -p %password% -i 1 -d C:\VNC2\UltraVNC\winvnc.exe -connect %COMPUTERNAME% -run %src_directory%\PSTools\PsExec \\%machine% -u %admin_user% -p %password% -i 1 -d cmd.exe pause goto supportType :MSRA REM - change the registry to allow it. REM %src_directory%\PSTools\PsExec \\%machine% reg add "hklm\system\currentcontrolset\control\terminal server" /f /v fDenyTSConnections /t REG_DWORD /d 0 REM %src_directory%\PSTools\PsExec \\%machine% reg add "hklm\system\currentcontrolset\control\terminal server" /f /v fAllowToGetHelp /t REG_DWORD /d 1 REM %src_directory%\PSTools\PsExec \\%machine% reg add "hklm\system\currentcontrolset\control\terminal server" /f /v AllowTSConnections /t REG_DWORD /d 1 REM %src_directory%\PSTools\PsExec \\%machine% reg add "hklm\system\currentcontrolset\control\terminal server" /f /v fAllowFullControl /t REG_DWORD /d 1 REM open the firewall XP REM %src_directory%\PSTools\PsExec \\%machine% netsh firewall set service remotedesktop enable REM %src_directory%\PSTools\PsExec \\%machine% netsh firewall set service remoteadmin enable REM open the fire wall Win 7 REM %src_directory%\PSTools\PsExec \\%machine% netsh advfirewall firewall set rule group="remote desktop" new enable=Yes REM %src_directory%\PSTools\PsExec \\%machine% netsh advfirewall firewall set rule group="Windows Remote Management" new enable=yes REM %src_directory%\PSTools\PsExec \\%machine% netsh advfirewall firewall set rule group="Remote Administration" new enable=yes REM %src_directory%\PSTools\PsExec \\%machine% netsh advfirewall firewall set rule group="windows firewall remote management" new enable=yes REM %src_directory%\PSTools\PsExec \\%machine% netsh advfirewall set currentprofile settings remotemanagement enable REM %src_directory%\PSTools\PsExec \\%machine% netsh advfirewall firewall set rule group="Remote Assistance" new enable=yes REM offer assistance msra /offerra %machine% echo. pause goto supportType :stopall %src_directory%\PSTools\PsKill \\%machine% winvnc.exe %src_directory%\PSTools\PsKill \\%machine% tvnserver.exe %src_directory%\PSTools\PsKill \\%COMPUTERNAME% vncviewer.exe %src_directory%\PSTools\PsKill \\%COMPUTERNAME% tvnviewer.exe REM del /F /Q \\%machine%\C$\VNC2\ rmdir \\%machine%\C$\VNC2\ /s /q echo. pause goto supportType :quit
No comments:
Post a Comment