Files
THE-TOOL/CMD/Remote-Verwaltung.cmd
2025-12-14 15:46:14 +01:00

246 lines
8.3 KiB
Batchfile

@echo off
cls
set VERZ=%~dp0
REM ------------------------------------------------------------
REM
REM ------------------------------------------------------------
REM Zusätzliche Befehle für die Computer Remoteverwaltung
REM ------------------------------------------------------------
REM WMIMgmt = start mmc C:\Windows\System32\WmiMgmt.msc /computer:localhost
REM Aufganbenplanung start mmc C:\Windows\System32\taskschd.msc /computer:localhost
REM Perfmon = start mmc C:\Windows\System32\perfmon.msc /computer:localhost
REM Freigegebene Ordner = start mmc C:\Windows\System32\fsmgmt.msc /computer:localhost
REM ------------------------------------------------------------
REM Verwendete Administrative Tools
REM ------------------------------------------------------------
REM PsTools von Windows Sysinternals --> http://technet.microsoft.com/de-de/sysinternals/bb896649.aspx
REM FreeCommander XE Portable --> http://www.freecommander.com/de/fc_downl_de.htm
REM ------------------------------------------------------------
REM ------------------------------------------------------------
:: Variablen definieren (Diese Varaiablen sollten angepasst werden)
REM ------------------------------------------------------------
REM set NetShare=Z:
REM set DomainAdminUser=DomainAdminUser
REM set ScriptPath=D:\Scripts\Remoteverwaltung
REM set FreeCommanderPath=D:\Scripts\Remoteverwaltung\FreeCommander
REM ------------------------------------------------------------
REM ------------------------------------------------------------
:: Eingabe des zu verwaltenden Computers
REM ------------------------------------------------------------
echo ====================================================================================================
echo Bitte Remote Computername oder IP-Adresse eingeben um das Skript starten zu koennen (z.B. localhost)
echo ====================================================================================================
set /p RemoteHost=Computername oder IP-Adresse eingeben:
echo RemoteHost=%RemoteHost% > %ScriptPath%\RemoteHostVar.txt
REM ------------------------------------------------------------
:: C$ Freigabe vom Remote Computer verbinden
REM ------------------------------------------------------------
REM echo C$ Freigabe zu %RemoteHost% verbinden -- Bitte Passwort eingeben
REM if exist %NetShare% net use /delete %NetShare% /yes
REM net use %NetShare% "\\%RemoteHost%\c$" /persistent:no /user:%USERDOMAIN%\%DomainAdminUser%
:START
title Computer Remoteverwaltung mit %RemoteHost%
mode 80,50
cls
REM ------------------------------------------------------------
:: Anzeigetext in der Batchdatei definieren
REM ------------------------------------------------------------
echo.
echo ============================================================
echo Aktion waehlen (1-15) - Derzeit verbunden mit %RemoteHost%
echo ============================================================
echo.
echo 1) Remote Computer wechseln
echo 2) Ping %RemoteHost%
echo 3) nslookup %RemoteHost%
echo 4) FreeCommander (Explorer) starten
echo 5) Dienste MMC von %RemoteHost% starten
echo 6) Computerverwaltung MMC von %RemoteHost% starten
echo 7) Ereignisanzeige MMC von %RemoteHost% starten
echo 8) Prozesse von %RemoteHost% anzeigen
echo 9) Registry Editor starten
echo 10) neue CMD Konsole starten
echo 11) Wer ist an %RemoteHost% angemeldet
echo 12) Benutzer am %RemoteHost% abmelden
echo 13) Computer %RemoteHost% neu starten
echo 14) Remoteunterstuetzung starten
echo 15) Exit
echo.
echo ============================================================
REM ------------------------------------------------------------
:: Auswahl wird in die Variable %choice% geschrieben
REM ------------------------------------------------------------
set /p choice=Auswahl:
if "%choice%"=="1" goto CHANGECOMPUTER
if "%choice%"=="2" goto PING
if "%choice%"=="3" goto NSLOOKUP
if "%choice%"=="4" goto FREECOMMANDER
if "%choice%"=="5" goto SERVICES
if "%choice%"=="6" goto COMPMGMT
if "%choice%"=="7" goto EVENTMGMT
if "%choice%"=="8" goto PROCESS
if "%choice%"=="9" goto REGEDIT
if "%choice%"=="10" goto OPENCMD
if "%choice%"=="11" goto LOGGEDON
if "%choice%"=="12" goto LOGOFF
if "%choice%"=="13" goto REBOOT
if "%choice%"=="14" goto REMOTEHELP
if "%choice%"=="15" net use /delete %NetShare% /yes && exit
REM ===================================================
:CHANGECOMPUTER
set /p RemoteHost=Bitte neuen Computername oder IP-Adresse eingeben:
echo RemoteHost=%RemoteHost% > %ScriptPath%\RemoteHostVar.txt
echo C$ Freigabe zu %RemoteHost% verbinden -- Bitte Passwort eingeben
if exist %NetShare% net use /delete %NetShare% /yes
net use %NetShare% "\\%RemoteHost%\c$" /persistent:no /user:%USERDOMAIN%\%DomainAdminUser%
goto START
REM ===================================================
REM ===================================================
:PING
ping -n 2 -4 %RemoteHost%
echo.
echo Bitte Taste druecken um zurueck zum Auswahlmenue zu kommen
pause >nul
goto START
REM ===================================================
REM ===================================================
:NSLOOKUP
nslookup %RemoteHost%
echo.
echo Bitte Taste druecken um zurueck zum Auswahlmenue zu kommen
pause >nul
goto START
REM ===================================================
REM ===================================================
:FREECOMMANDER
start %FreeCommanderPath%\FreeCommander.exe
goto START
REM ===================================================
REM ===================================================
:SERVICES
start mmc "%SystemRoot%\System32\services.msc" /computer:%RemoteHost%
goto START
REM ===================================================
REM ===================================================
:COMPMGMT
start mmc "%SystemRoot%\System32\compmgmt.msc" /computer:%RemoteHost%
goto START
REM ===================================================
REM ===================================================
:EVENTMGMT
start mmc "%SystemRoot%\System32\eventvwr.msc" /computer:%RemoteHost%
goto START
REM ===================================================
REM ===================================================
:PROCESS
sc \\%RemoteHost% start RemoteRegistry
pslist -t -s -r 5 \\%RemoteHost%
echo.
echo Bitte Taste druecken um zurueck zum Auswahlmenue zu kommen
pause >nul
goto START
REM ===================================================
REM ===================================================
:REGEDIT
sc \\%RemoteHost% start RemoteRegistry
%SystemRoot%\System32\regedt32.exe && mshta "javascript:var sh=new ActiveXObject( 'WScript.Shell' ); sh.Popup('Bitte ueber [Datei] --> [Mit Netzwerkregistrierung verbinden], den Computernamen eingeben. Fenster schliesst automatisch nach 10 Sekunden.',10, 'Remote Registry', 64 );close()"
goto START
REM ===================================================
REM ===================================================
:OPENCMD
start /i %COMSPEC% /separate /k (for /f "tokens=*" %%i in (%ScriptPath%\RemoteHostVar.txt) do set "%%i")2>nul
goto START
REM ===================================================
REM ===================================================
:LOGGEDON
sc \\%RemoteHost% start RemoteRegistry
psloggedon \\%RemoteHost%
echo.
echo Bitte Taste druecken um zurueck zum Auswahlmenue zu kommen
pause >nul
goto START
REM ===================================================
REM ===================================================
:LOGOFF
sc \\%RemoteHost% start RemoteRegistry
start /i %COMSPEC% /seperate /k psexec \\%RemoteHost% query session && mshta "javascript:var sh=new ActiveXObject( 'WScript.Shell' ); sh.Popup('Um den Remote User abzumelden, bitte (logoff [ID]) eingeben und mit [Enter] bestätigen. Fenster schliesst automatisch nach 10 Sekunden.',10, 'Remote User Logoff', 64 );close()"
echo.
echo Bitte Taste druecken um zurueck zum Auswahlmenue zu kommen
pause >nul
goto START
REM ===================================================
REM ===================================================
:REBOOT
sc \\%RemoteHost% start RemoteRegistry
%VERZ%\psshutdown.exe -r -t 5 \\%RemoteHost%
echo.
echo Bitte Taste druecken um zurueck zum Auswahlmenue zu kommen
pause >nul
goto START
REM ===================================================
REM ===================================================
:REMOTEHELP
msra.exe /offerRA %RemoteHost%
echo.
echo Bitte Taste druecken um zurueck zum Auswahlmenue zu kommen
pause >nul
goto START
REM ===================================================