Solved Prevent a service from starting up without disabling it?

sleepless

New member
Local time
12:53 AM
Messages
84
Is there a way to prevent a service from starting up without disabling it completely. I want to be able to start/stop a service by using a .bat shortcut, but that doesn't seem to work if it's disabled. If I set to Manual, the service auto starts with startup. The service is "Function Discovery Resource Publication" - FDResPub. :huh:
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Asus K52N
OS
Windows 7 Ultimate x64 SP1
CPU
AMD Turion II P540
Motherboard
Asus
Memory
6 GB
Graphics Card(s)
ATI Radeon HD 4200
Antivirus
Avast
Browser
Chrome

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom Built By Me.
OS
Windows 10 Pro 64 bit
CPU
AMD FX 9590 8 Core Black Edition
Motherboard
MSI 990FXA GAMING (MS-7893)
Memory
Corsair Vengeance 16GB DDR3
Graphics Card(s)
AMD Radeon (TM) R9 380 Gaming Series
Sound Card
AMD High Definition
Monitor(s) Displays
Samsung 32" 60Hz 4ms Curved PLS LED
Screen Resolution
1920 X 1080
Hard Drives
C: 223 GB SSD = E: 465 GB HDD = F: 931 GB HDD = G: 149 GB HDD = H: 931 GB HDD
PSU
EVGA Supernova NEX750B 750W ATX EPS12V 80PLUS Bronze
Case
Cool Master
Cooling
Noctua NH-D15 Premium Cooler with 2x NF-A15 PWM 140mm Fan
Internet Speed
Fiber Optic: Download 332.7 Mbps / Upload 331.5 Mbps
Antivirus
Windows Defender
Browser
Slimjet (64bit)

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Asus K52N
OS
Windows 7 Ultimate x64 SP1
CPU
AMD Turion II P540
Motherboard
Asus
Memory
6 GB
Graphics Card(s)
ATI Radeon HD 4200
Antivirus
Avast
Browser
Chrome
-is it possible to start a service from a .bat if it's been disabled? NO

-is there a way to prevent a service from running on startup without disabling it? NO

That's the brunt of it.
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom Built By Me.
OS
Windows 10 Pro 64 bit
CPU
AMD FX 9590 8 Core Black Edition
Motherboard
MSI 990FXA GAMING (MS-7893)
Memory
Corsair Vengeance 16GB DDR3
Graphics Card(s)
AMD Radeon (TM) R9 380 Gaming Series
Sound Card
AMD High Definition
Monitor(s) Displays
Samsung 32" 60Hz 4ms Curved PLS LED
Screen Resolution
1920 X 1080
Hard Drives
C: 223 GB SSD = E: 465 GB HDD = F: 931 GB HDD = G: 149 GB HDD = H: 931 GB HDD
PSU
EVGA Supernova NEX750B 750W ATX EPS12V 80PLUS Bronze
Case
Cool Master
Cooling
Noctua NH-D15 Premium Cooler with 2x NF-A15 PWM 140mm Fan
Internet Speed
Fiber Optic: Download 332.7 Mbps / Upload 331.5 Mbps
Antivirus
Windows Defender
Browser
Slimjet (64bit)
Whenever something is as difficult as this a reasonable question is: Why do you wish to do this?
What are you trying to accomplish that requires such an unusual service configuration?
Maybe there is a better way.
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP
OS
Windows 7 Pro 64 bit
CPU
Xeon W3520
Memory
8 GB
Graphics Card(s)
Nvidia Geforce 210
Got it. Looks like it's a 2-step process. stop>disable>enable>start. This makes it pointless to run from a batch as it's just qucker to open a shortcut to services.msc and change the settings from there.

thanks.
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Asus K52N
OS
Windows 7 Ultimate x64 SP1
CPU
AMD Turion II P540
Motherboard
Asus
Memory
6 GB
Graphics Card(s)
ATI Radeon HD 4200
Antivirus
Avast
Browser
Chrome
Whenever something is as difficult as this a reasonable question is: Why do you wish to do this?
What are you trying to accomplish that requires such an unusual service configuration?
Maybe there is a better way.

Simply, there's a service which I don't want to run on startup. I want to control when it runs it manually. I thought (wrongly) that setting the service to 'manual' would accomplish this. Instead it turns out I need to stop the service, then disable it This means it is a 2-step process to start it again also.

Is manually controlling a service really such an "unusual configuration"? :huh:
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Asus K52N
OS
Windows 7 Ultimate x64 SP1
CPU
AMD Turion II P540
Motherboard
Asus
Memory
6 GB
Graphics Card(s)
ATI Radeon HD 4200
Antivirus
Avast
Browser
Chrome

My Computer My Computer

Computer Manufacturer/Model Number
HP Media Center
OS
Windows 7 32 bit
CPU
AMD 5200+ dual core
Memory
2 GB
Graphics Card(s)
NVidia GeForce 6150SE 128 MB
Monitor(s) Displays
CRT
Screen Resolution
1280x1024
Hard Drives
500 GB Sata internal :

SIIG USB 3.0 docking stations w/WD Caviar Black 6 Gb/s drives
Keyboard
PS/2
Mouse
PS/2 Wheel Mouse
Other Info
SIIG USB 3.0 PCIexpress card.
-is it possible to start a service from a .bat if it's been disabled?
-is there a way to prevent a service from running on startup without disabling it?
No and no. But that doesn't mean there isn't a solution.

Triggering a service while its start mode is set to Disabled can be achieved by quickly setting the start mode to Enabled, starting the service, then Disabling the service again in quick succession. This'll work because, a disabled service cannot be started, however, a service that is disabled while it is running will continue to run until manually stopped.

E.g., assume the disabled service "RemoteRegistry". This service can be started using the below example batch file
Code:
[B]@echo off[/B]
REM Starts a disabled service by first enabling it, starting it, then disabling it again.
REM Some services may require Run As Administrator to start.
 
REM Tested the script with 'RemoteRegistry' service.
[B]set "service=RemoteRegistry"[/B]
REM Stop script execution if the service's start mode is not currently disabled
[B]sc qc "%SERVICE%" | find "START_TYPE" | find "4" >NUL || (echo Start mode of given service is not disabled& exit /b 1)[/B]
REM Stop script execution if the service is already runnning
[B]sc query "%SERVICE%" | find "STATE" | find "4" >NUL && (echo Service is already running& exit /b 1)[/B]
REM Set start mode of service to Manual
[B]sc config "%SERVICE%" start=demand[/B]
REM Start the service
[B]sc start "%SERVICE%"[/B]
REM Set service start mode back to Disabled
[B]sc config "%SERVICE%" start=disabled[/B]


[...] This makes it pointless to run from a batch as it's just qucker to open a shortcut to services.msc and change the settings from there.
I highly doubt the efficiency of your clicking competes with a script.

I want to control when [the service] runs it manually. I thought (wrongly) that setting the service to 'manual' would accomplish this.
Ditto. There must a process explicitly requesting that your service be started. It's tricky to tell which process this is, and even then there is no way to prevent it from doing so.

Is manually controlling a service really such an "unusual configuration"? :huh:
Depending on your goal; there may be a more optimal method.
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
Back
Top