Skip to content

Instantly share code, notes, and snippets.

@xchwarze
Last active July 24, 2024 20:25
Show Gist options
  • Save xchwarze/b36b892f3bcb173834d3e5bc1cd9cf25 to your computer and use it in GitHub Desktop.
Save xchwarze/b36b892f3bcb173834d3e5bc1cd9cf25 to your computer and use it in GitHub Desktop.
MSI Center manual control
@echo off
title MSI Service and Process Management Script
:: Check for administrative privileges
net session >nul 2>&1
IF NOT %ERRORLEVEL% EQU 0 (
ECHO ERROR: Please run this script as Administrator.
PAUSE
EXIT /B 1
)
:: Prompt the user for the start type
echo Press 1 for Manual, 2 for Disabled, 3 for Automatic
set /p choice="Enter your choice: "
:: Determine the start type based on user input
if "%choice%"=="1" set "starttype=demand"
if "%choice%"=="2" set "starttype=disabled"
if "%choice%"=="3" set "starttype=auto"
:: Apply the configuration to each service
call :ConfigureService "MSI_Center_Service" %starttype%
call :ConfigureService "MSI Sendevsvc" %starttype%
:: List of processes to kill
set "processes=MSI.TerminalServer.exe MSI.CentralServer.exe Start_HDR.exe VoiceControl_Engine.exe VoiceControl_Service.exe DCv2.exe"
:: Kill listed processes
echo Killing specified processes...
for %%p in (%processes%) do (
taskkill /F /IM "%%p" /T
)
echo Configuration and cleanup complete.
pause
EXIT /B 0
:: Function to configure and control service
:ConfigureService
echo Configuring %1 to %2...
sc config %1 start= %2
if "%2"=="demand" sc stop %1
if "%2"=="disabled" sc stop %1
if "%2"=="auto" sc start %1
goto :eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment