33 lines
1.1 KiB
Batchfile
33 lines
1.1 KiB
Batchfile
@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
|
|
|
|
:menu
|
|
set switch=
|
|
set start=
|
|
cls
|
|
echo Veeam Services Control
|
|
echo ----------------------
|
|
echo 1) Start
|
|
echo 2) Stop
|
|
echo 3) Restart
|
|
echo ----------------------
|
|
choice /c:123 /n /m "#: "
|
|
|
|
if "%errorlevel%"=="1" set switch=start
|
|
if "%errorlevel%"=="2" set switch=stop
|
|
if "%errorlevel%"=="3" (
|
|
set switch=stop
|
|
set 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 "postgresql-x64-15"^|find /i /v "veeam.archiver"') do net %switch% /y "%%?"
|
|
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 "postgresql-x64-15"^|find /i /v "veeam.archiver"') do net start /y "%%?"
|
|
|
|
echo ""
|
|
#pause
|
|
#goto menus
|
|
|
|
:eof
|