|
Answer» Hello, 1. From this COMMAND output: SC query state= all
..... SERVICE_NAME: WPDBusEnum DISPLAY_NAME: Service Énumérateur d'appareil mobile TYPE : 20 WIN32_SHARE_PROCESS STATE : 4 RUNNING (STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN) WIN32_EXIT_CODE : 0 (0x0) SERVICE_EXIT_CODE : 0 (0x0) CHECKPOINT : 0x0 WAIT_HINT : 0x0
SERVICE_NAME: wuauserv DISPLAY_NAME: Windows Update TYPE : 20 WIN32_SHARE_PROCESS STATE : 4 RUNNING (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN) WIN32_EXIT_CODE : 0 (0x0) SERVICE_EXIT_CODE : 0 (0x0) CHECKPOINT : 0x0 WAIT_HINT : 0x0 .....
is there a way to get only the DISPLAY_NAME value and SERVICE_NAME value (both on 1 line) ?
..... Service Énumérateur d'appareil mobileWPDBusEnum Windows Updatewuauserv ....
Maybe, using a temp. file: SC QUERY state= all>"allSrv.txt"
1.a. Is SERVICE_NAME the name used with the commands "NET START" or "NET STOP" ? 1.b. Is this list the same as this ONE: Start > Run > services.msc ?
Then I'll build a MngServices.bat script to manage services I would stop. Example: MngServices.bat
NET STOP stisvc NET STOP CryptSvc NET STOP Themes
2. How should I use this script MngServices.bat ? 2.a. Should I run this script once or for each Windows start ? 2.b. In the second case, what is the best way to run the script at Windows start ?
Thanks CONFIG: MS Windows Vistahere's a vbscript Code: [Select]strComputer = "." Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colRunningServices = objWMIService.ExecQuery("Select * from Win32_Service")
For Each objService in colRunningServices Wscript.Echo objService.DisplayName & VbTab & objService.Name Next usage: save as myscript.vbs, and on command line, type in cscript /nologo myscript.vbs
|