I know you can remotely shutdown a Windows machine with the "shutdown" command line. But I think it's impossible to remotely get a machine into safe mode (with networking). Does anyone know of a way to do this?

10 Answers 10


If you have admin rights on the remote machine then it's possible.

You need to edit the boot.ini file (usually found on the root of the C: drive)

Open a command prompt on your local machine



The boot ini file will open which usually looks something like this:

[boot loader]
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional"  
/noexecute=optin /fastdetect

On the end of the last line you need to add


the last line will then read something like

multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional"  
/noexecute=optin /fastdetect /safeboot:network

Save the changes and then force a reboot from the command line and it should restart into safe mode with networking. Remember to change the boot.ini file back when you're done!

  • 2
    Its also worth mentioning that RDP might not work in safe mode. I haven't tried/tested it myself but I've been told it doesn't work on XP Home. Your mileage may vary.
    – KPWINC
    Commented Aug 17, 2009 at 16:05
  • 3
    This doesn't work with Vista/7. Using msconfig.exe works in XP, Vista and 7 (and is easier).
    – mivk
    Commented May 26, 2012 at 7:37

To reboot Windows 7 into safe mode with networking, run msconfig.exe. On the Boot tab, you can select "Safe boot" and there is a checkbox for networking.

I'm not sure if Remote Desktop will run in safe mode. I use TightVNC. To have the TightVNC service start in safe mode, copy it's registry entry to safeboot\network:

REG COPY HKLM\system\CurrentControlSet\services\tvnserver HKLM\system\CurrentControlSet\control\safeboot\network\tvnserver /s /f

Other VNC services can probably be activated in the same way.

  • I have used this many times with vnc. It works great.
    – johnny
    Commented Apr 28, 2015 at 14:39
  • This works perfectly for Windows Server 2008 R2 as well. It should be the accepted answer IMO
    – patrick
    Commented Aug 8, 2017 at 8:30
  • 1
    RE: MSCONFIG + RDP. Restarting Windows Server 2008 R2 in safemode with networking enabled, the RDP service didn't come up. I could MMC into services, but starting "Remote Desktop Services" gives "Error 1084: This service cannot be started in Safe Mode"
    – JohnLBevan
    Commented Apr 2, 2020 at 10:27
  • One thing I had to be careful of: disable the firewall before booting into Safe Mode...otherwise I was locked out completely.
    – BaseZen
    Commented Dec 10, 2020 at 8:15

Not likely for a workstation machine. You need something that gives you control of the machine itself in order to tell Windows how to boot.

You will have more luck on server hardware as many vendors build in an option to connect to the console remotely.

If you have the option to interactively connect to Windows on the machine, though, you can use MSCONFIG to set the /SAFEBOOT switch in boot.ini, then reboot the machine. Do Start -> Run and type in MSCONFIG, then on the boot.ini tab check /SAFEBOOT under Boot Options and choose which safe mode you want to boot into (in this scenario, NETWORK).


LogMeIn has a safemode reboot option.


This is exactly what HP's integrated lights-out option is for. Editing the boot.ini file won't be much help, since you won't be able to log into the machine, as the RDP service won't run. In case that's an HP server though you can connect directly to it's console via https portal, and also have access to virtual "power button".


Not an answer to the question, but hopefully useful to anyone who's hit issues when trying this. I found that despite rebooting in safe mode with networking, various services including Remote Desktop Services and Server (i.e. providing SMB access to boot.ini) failed to start, giving error code 1084 when started via MMC > Services.

The below powershell uses WMI (which seems to still work) to take the remote computer out of safe mode and restart it.

Function Repair-RemoteSafeModeBoot {
    Param (
        [Parameter(Mandatory = $true)]
    if (-not (Test-Connection -ComputerName $ComputerName -Quiet -Count 1 -ErrorAction 'Stop')) {
        throw "Could not ping $ComputerName; no attempt made to fix it"
    $os = Get-WmiObject -ComputerName $ComputerName -Class 'Win32_OperatingSystem' -ErrorAction 'Stop'
    Write-Verbose "Computer $ComputerName last rebooted at $($os.ConvertToDateTime($os.LastBootUpTime))"
    $cs = Get-WmiObject -ComputerName $ComputerName -Class 'Win32_ComputerSystem' -ErrorAction 'Stop'
    Write-Verbose "Computer $ComputerName bootup state is $($cs.BootupState)"
    if ($cs.BootupState -eq 'Normal boot') {
        Write-Warning "$ComputerName is not in safe mode; no attempt to fix it was made"
        return # we don't want to proceed if the remote device is already in normal mode as we may do more harm than good (unlikely to have any impact tbh; but why risk it)
    if ($cs.BootupState -ne 'Fail-safe with network boot') {
        Write-Warning "$ComputerName has boot up state $($cs.BooupState).  I've never tested with these states, so can't say what will happen.  Please read up on this & if acceptable to proceed amend this script to enable it for your scenario."
        return # probably safe to remove this & continue; but I don't want to be responsible for that decision... Comment this statement out at your own risk

    # run a command on the remote computer to take it out of safe mode: https://superuser.com/a/706664/156700
    $rv = Invoke-WmiMethod –ComputerName $ComputerName -Class 'win32_process' -Name 'create' -ArgumentList 'bcdedit /deletevalue {default} safeboot' -ErrorAction 'Stop' | Select-Object -ExpandProperty ReturnValue
    if ($rv -ne 0) {
        throw "Attempted to run bcdedit, but received return value $rv implying that the command was unsuccessful"
    Start-Sleep -Seconds 5 # probably not required; but added to be safe.  It's not like 5 seconds is much to ask if you're in this scenario.

    #restart the remote computer
    $rv = $os.Reboot() | Select-Object -ExpandProperty ReturnValue
    if ($rv -ne 0) {
        throw "Attempted to reboot the remote device, but received return value $rv, implying that the command was unsuccessful"

    Write-Information "$ComputerName updated to normal mode & restarted.  Wait a few minutes whilst the reboot occurs then try to log in.  If you still have issues try rerunning this command with the -Verbose flag enabled to check whether the boot time or mode have changed."   

Repair-RemoteSafeModeBoot -ComputerName 'MyServer' -Verbose # where MyServer is the name of the remote server in safe mode

Note: You can just run the 3 lines below; the function above is just there as a convenience wrapper. I've not tested the above cmdlet; though I have used this method without the wrapper so can say that all individual parts work.

$ComputerName = 'MyServer'
Invoke-WmiMethod –ComputerName $ComputerName -Class 'win32_process' -Name 'create' -ArgumentList 'bcdedit /deletevalue {default} safeboot'
(Get-WmiObject -ComputerName $ComputerName -Class 'Win32_OperatingSystem').Reboot()

Note: I've only tried this on Windows Server 2008 R2. YMMV.


That answer above about edit the boot.ini , is nice and all -- EXCEPT....you can't change the boot.ini file...if you follow "Mark's" directions step by step - you hit a brick wall because the boot.ini is read only.

EDIT: And yes....I tested it signed in as an administrator to.

  • 3
    So change it.... Right Click ---> Properties and uncheck "read-Only"... If you're in the remote computer's c$ with administrative rights you should have no problem doing that.
    – user81808
    Commented May 18, 2011 at 9:25

If you hastily chose to modify the BOOT.ini to restart in safe mode with networking, and then restart, you will find that you cannot remotely log in at all. You WILL likely be able to view the boot file \\machinename\C$\boot.ini, but won't be able to modify it because it is read only. You will also not be able to "right-click and uncheck 'read-only' " because you won't be able to navigate to the C$ directory at all. I now have to physically login to this virtual workstation in order to change the boot.ini back. I will never make that mistake again!

  • It may feel like a mistake but it could be taken as experience gained, knowhow level up. Next time you will have your failover plans ready? ...and SSH services active, remember WMIC? WMI works perfectly in safe mode, you could for example reboot to normal if there is no activity in safe mode for some period of time. And of course you could use WMI for altering boot process. Commented Oct 10, 2012 at 18:55

What happened to the boot.ini file?

Windows 7 More

In earlier versions of Windows, boot.ini was a system file that contained information about the Windows operating systems installed on a computer. This information was displayed during the startup process when you turned on your computer. It was most useful in multiboot configurations, or for advanced users or administrators who needed to customize how Windows started.

In this version of Windows, the boot.ini file has been replaced with Boot Configuration Data (BCD). This file is more versatile than boot.ini, and it can apply to computer platforms that use means other than basic input/output system (BIOS) to start the computer.

If you need to make changes to BCD, such as removing entries from the list of displayed operating systems, use the command-line tool Bcdedit, an advanced tool intended for administrators and IT professionals. For technical information about Bcdedit, go to the Microsoft website for IT professionals.

If your computer is a multiboot configuration, you can still change which Windows operating system opens by default, and how long to display the list of operating systems, by using System in Control Panel.

  1. Open System by clicking the Start button Picture of the Start button, right-clicking Computer, and then clicking Properties.

2.In the left pane, click Advanced system settings. Administrator permission required If you're prompted for an administrator password or confirmation, type the password or provide confirmation.

3.Click the Advanced tab, and then, under Startup and Recovery, click Settings.

4.Under System startup, choose a default operating system and the amount of time to display the list of operating systems, click OK, and then click OK again.



If you should make this mistake, you will likely be able to navigate to the boot.ini file via File Explorer, so \hostname\C$\boot.ini, and there is a chance you will also be able to remove "/safeboot:network" and save.

If you can save the change to the boot.ini file, then run a command prompt as admin and try running this command to reboot: shutdown /r /m \hostname /t 00

Hopefully with this you'll be back in business!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .