How to DISABLE certain services from running in safe mode but run in normal boot in Windows 7

2

I have the following question. How to disable certain services in safe mode only - they must run in normal start but not in safe mode. We are talking about Win 7 64bit. The problem is that the computer boots normally in normal mode, but restarts at login screen when you try to boot in safe mode, i made clean boot and found that all was ok to login in safe mode, so there is certain service that (haven't identified yet) depends on other service which is not running and that causes the system to crash. It is completely normal and okay if all of services i have to run in normal start, but they should be disabled in safe mode (besides the bare minimum). So I want to disable and thus prevent certain services from starting when I go in safe mode only. Best Regards.

USER

Posted 2019-10-31T20:36:26.953

Reputation: 21

Sorry for the delay, in this case it was not Microsoft service but other program. Disabled all and rebooted in SM. Started enabling in batches of 10 and reboot in SM, then again from there - enabled 10 more. So i caught the faulty one. In this case it was not in the registry either - just made it to start Manually if needed and that was all. System is purring as a cat. I wonder however where it was marked as if not in the registry - when turned to automatic it still was not there, and startup items where enabled all the time - didn't touch them (I was sure that the problem was service). – USER – 2019-11-06T17:56:51.247

Answers

1

Have a look in the registry under

HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot

This registry key is how Windows knows which services to load when doing a boot into Safe Mode (Minimal), or Safe Mode w/ Networking (Network). All the subkeys under those two represent system service names as they are recorded in HKLM\SYSTEM\CurrentControlSet\Services.

If you want to stop a particular service from running during Safe Mode, simply delete it from the Minimal key. If you want to add a service, find it's name in HKLM\SYSTEM\CurrentControlSet\Services and add it following the examples provided by the other keys that are already there.

For example, if you need the Windows Installer service to be running in Safe Mode (as has been the case for me before), you would add a key called msiserver under Minimal and set its default value to Service. Next time you boot into Safe Mode, the Windows Installer service will be running.

It should go without saying here, but make sure you back up the key before making changes.

Wes Sayeed

Posted 2019-10-31T20:36:26.953

Reputation: 12 024

Now that's a thing, I intend to experiment during the weekend with this. I can see from my notebook that enters SafeMode, what services are starting and what registry entries there are in that one. Then we will see what goes where. Thanks. – USER – 2019-11-01T19:26:17.253

0

The problem as you word it is probably unsolvable.

I would therefore advise looking at it backwards: How to enable certain services only in Normal boot.

The answer would be to disable these services, but create a .bat script that will run on boot and will start them running. This script will not run when booting in Safe mode.

The command to use in the script is net start per each service.

That is simpler and I think workable.

harrymc

Posted 2019-10-31T20:36:26.953

Reputation: 306 093

Noo. Could not be - there are tons of services that run one way or another at some point in normal mode. Most of them all the time. There has to be something that controls them. But thanks - just rather Draconian measures :P Will do so in last resort perhaps. Thanks. – USER – 2019-11-01T19:28:50.013

0

You can try this powershell script, It was tested on powershell v5.1 , please create a task that run this script after boot on the Task Scheduler:

    function Disable_Process( [Parameter(Mandatory=$true)][string]$process_name ) {

        $machine_state = Get-WmiObject win32_computersystem | Select-Object  -ExpandProperty BootupState

        if ( $machine_state -match "Fail-safe boot"  ) {

            Stop-Process -Name "$process_name" -Force

        }  elseif ( $machine_state -match "Fail-safe with network boot") {

            Stop-Process -Name "$process_name" -Force

        }

        Write-Host "Process(es) stopped:"
        Get-Process | Where-Object {$_.HasExited} | Out-File C:\processes_stoped.txt

    }

    Disable_Process "process_name_you_want_to_stop" #You can repeat this line as many times as necessary

If you wanna check the true service name you should run "services.msc", then rigth click on the service, then click on properties and copy the field "Service Name".

Haroldo Payares Salgado

Posted 2019-10-31T20:36:26.953

Reputation: 326

The Task Scheduler doesn't run in Safe mode. – harrymc – 2019-11-01T07:40:12.717

My thoughts also (for scheduler and safe mode). Can you explain to me how will this work and in what mode actually? (I am not very acquainted with powershell). – USER – 2019-11-01T19:32:44.903