How to Restart Windows Explorer (explorer.exe) Remotely via PowerShell or CMD


1 views

Dealing with a frozen Windows Explorer on remote servers is particularly frustrating because:

  • You maintain RDP connectivity but lose GUI functionality
  • Critical server management tasks become inaccessible
  • Forced reboots may disrupt running services

The most reliable approach uses PowerShell remoting:

Invoke-Command -ComputerName SERVER01 -ScriptBlock {
    Stop-Process -Name explorer -Force
    Start-Process explorer.exe
}

Pro tip: Add error handling for robust automation:

try {
    Get-Process explorer -ErrorAction Stop | Stop-Process -Force
    Start-Sleep -Seconds 2
    Start-Process explorer.exe
} catch {
    Write-EventLog -LogName Application -Source 'Explorer Restarter' -EntryType Error -EventId 100 -Message "Explorer restart failed: $_"
}

When PSRemoting isn't available, use this CMD sequence:

taskkill /f /im explorer.exe
timeout /t 3 /nobreak >nul
start explorer.exe

For multi-user environments: Target specific sessions using tskill with session IDs:

query session
tskill explorer /A /ID:1

Automated monitoring solution: Create a scheduled task that runs this PowerShell watchdog script:

$explorer = Get-Process explorer -ErrorAction SilentlyContinue
if (-not $explorer) {
    Start-Process explorer.exe
    Add-Content -Path "C:\logs\explorer_restarts.log" -Value "$(Get-Date): Restarted crashed explorer"
}
  • Check for hung processes with tasklist /fi "status eq not responding"
  • Verify system resources with perfmon /res
  • Examine Windows Event Logs for related errors

Common causes and mitigations:

Cause Solution
Shell extensions Use autoruns to disable problematic add-ons
Memory leaks Implement regular explorer.exe recycling
GDI handles Monitor with handle.exe from Sysinternals

When Windows Explorer (explorer.exe) crashes on a remote server, it can leave you with a functional RDP session but no GUI shell. This prevents access to the Start menu, taskbar, or file explorer while keeping background processes running.

The most straightforward approach is killing the process and restarting it:


taskkill /f /im explorer.exe
start explorer.exe

For servers with PowerShell access, this provides more control:


Stop-Process -Name explorer -Force
Start-Process explorer.exe

For frequent issues, create a batch file with error handling:


@echo off
tasklist /fi "imagename eq explorer.exe" | find "explorer.exe" > nul
if errorlevel 1 (
    echo Explorer not running, starting new instance
    start explorer.exe
) else (
    echo Restarting explorer...
    taskkill /f /im explorer.exe
    timeout /t 2 > nul
    start explorer.exe
)

If you need to run this on a remote server:


psexec \\remote-server -u admin -p password cmd /c "taskkill /f /im explorer.exe & start explorer.exe"

  • Check Event Viewer for underlying causes (eventvwr.msc)
  • Verify sufficient system resources (RAM, CPU)
  • Scan for corrupt system files: sfc /scannow
  • Consider creating a scheduled task as fallback

To avoid future crashes:


# PowerShell script to monitor explorer.exe
while ($true) {
    if (-not (Get-Process explorer -ErrorAction SilentlyContinue)) {
        Start-Process explorer.exe
        Write-EventLog -LogName Application -Source "Explorer Monitor" -EntryType Warning -EventId 100 -Message "Explorer restarted"
    }
    Start-Sleep -Seconds 30
}