Update Veeam-Services-Control.cmd

This commit is contained in:
2024-06-18 19:04:23 -05:00
parent 2a2292a523
commit dc2f8c232b

View File

@@ -1,29 +1,32 @@
@echo off @echo off
fsutil dirty query "%SystemDrive%">nul 2>&1 || "%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -Command "Start-Process '%~f0' -Verb RunAs" 2>nul && goto :eof || goto :eof fsutil dirty query "%SystemDrive%">nul 2>&1 || "%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -Command "Start-Process '%~f0' -Verb RunAs" 2>nul && goto :eof || goto :eof
:menu :menu
set switch= set switch=
set start= set start=
cls cls
echo 1) Start echo Veeam Services Control
echo 2) Stop echo ----------------------
echo 3) Restart echo 1) Start
echo 2) Stop
choice /c:123 /n /m "Choose: " echo 3) Restart
if "%errorlevel%"=="1" set switch=start echo ----------------------
if "%errorlevel%"=="2" set switch=stop choice /c:123 /n /m "#: "
if "%errorlevel%"=="3" (
set switch=stop if "%errorlevel%"=="1" set switch=start
set start=true if "%errorlevel%"=="2" set switch=stop
) if "%errorlevel%"=="3" (
set switch=stop
for /f "tokens=2" %%? in ('sc query type^= service state^= all^|find /i "veeam"^|find /i "service_name"^|find /i /v "sqlagent"^|find /i /v "veeam.archiver"') do net %switch% /y "%%?" set start=true
if "%switch%"=="stop" for /f "tokens=3*" %%? in ('tasklist /fo list^|find /i "veeam"^|find /i /v "veeam.archiver"') do taskkill /f /im "%%?" )
if "%start%"=="true" for /f "tokens=2" %%? in ('sc query type^= service state^= all^|find /i "veeam"^|find /i "service_name"^|find /i /v "sqlagent"^|find /i /v "veeam.archiver"') do net start /y "%%?"
for /f "tokens=2" %%? in ('sc query type^= service state^= all^|find /i "veeam"^|find /i "service_name"^|find /i /v "sqlagent"^|find /i /v "veeam.archiver"') do net %switch% /y "%%?"
echo "" if "%switch%"=="stop" for /f "tokens=3*" %%? in ('tasklist /fo list^|find /i "veeam"^|find /i /v "veeam.archiver"') do taskkill /f /im "%%?"
#pause if "%start%"=="true" for /f "tokens=2" %%? in ('sc query type^= service state^= all^|find /i "veeam"^|find /i "service_name"^|find /i /v "sqlagent"^|find /i /v "veeam.archiver"') do net start /y "%%?"
#goto menus
echo ""
:eof #pause
#goto menus
:eof