Windows Internals & Automation

Windows Registry, Services & Task Scheduler

Your practical cockpit for Windows under the hood: query and back up Registry hives safely, control background Services from CLI, automate jobs with Task Scheduler, and troubleshoot boot settings with bcdedit.

โฑ๏ธ 10 min read๐ŸŸข Beginner Friendly๐Ÿ“… Updated: 2026

0 Anatomy of a Registry Path

The Windows Registry is a hierarchical database (like folders and files) that stores OS, hardware, and app settings. Every entry has four parts:

HKLM\SYSTEM\CurrentControlSet\Services\Spooler โ†’ Start = 2 (REG_DWORD)
Root Hive HKLM System-wide config
Subkey Path ...\Services\Spooler Folder-like location
Value Name & Type Start (REG_DWORD) 32-bit integer setting
Value Data 2 2 = Automatic start
5 ROOT REGISTRY HIVES HKLM Machine & Services HKCU Current User Prefs HKCR File Associations HKU All User Profiles HKCC Active Hardware reads services.exe (SCM) Service Control Manager Auto / Manual / Delayed Start Task Scheduler Triggers: Time, Logon, Event svchost.exe Hosts DLL-based services Standalone .exe spoolsv.exe, MsMpEng.exe Scheduled Jobs Scripts, Backups, Updates
Windows boots by reading service definitions from HKLM, launching them via services.exe (SCM) into svchost.exe or standalone executables.

01 The 5 Root Hives & Registry CLI

All Windows Registry keys live inside five top-level root hives. Knowing which hive holds machine-wide vs. per-user settings saves hours of troubleshooting.

Short Full Hive Name What It Stores Real-World Example
HKLM HKEY_LOCAL_MACHINE System-wide hardware, OS, drivers, and Windows Services (affects all users). HKLM\SYSTEM\CurrentControlSet\Services
HKCU HKEY_CURRENT_USER Settings for the currently logged-in user (desktop, Run apps, theme). HKCU\Software\Microsoft\Windows\CurrentVersion\Run
HKCR HKEY_CLASSES_ROOT File extensions (.pdf, .txt) and COM object associations. Merged view of HKLM + HKCU. HKCR\.txt
HKU HKEY_USERS All loaded user profiles on the PC, mapped by Security Identifier (SID). HKCU is a link into HKU. HKU\.DEFAULT (login screen prefs)
HKCC HKEY_CURRENT_CONFIG Active hardware profile used at boot (shortcut to HKLM\SYSTEM\CurrentControlSet\Hardware Profiles\Current). Display & hardware profile state

Essential Registry Commands (CMD & PowerShell)

reg query
Read a Registry Key or Value
Lists all subkeys and values under a path without opening Regedit GUI.
Example: reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Run"
reg export
Back Up a Key to a .reg File Admin for HKLM
Exports a branch before you edit it. Double-click or use reg import to restore.
Example: reg export "HKLM\SOFTWARE\MyApp" C:\backup\myapp.reg /y
reg add
Create or Update a Registry Value Admin for HKLM
/v = value name, /t = data type (REG_SZ, REG_DWORD), /d = data, /f = overwrite without prompt.
Example: reg add "HKCU\Software\MyApp" /v Enabled /t REG_DWORD /d 1 /f
Get-ItemProperty
Read Registry Values as Objects (PowerShell)
PowerShell mounts hives as drives (HKLM:\, HKCU:\) so you can filter properties cleanly.
Example: Get-ItemProperty "HKLM:\...\CurrentVersion" | Select ProductName

02 Windows Services CLI

Services are background programs that run without a window โ€” even before you log in. Many built-in services are DLLs hosted inside shared svchost.exe processes to save memory.

Get-Service
List & Filter Services (PowerShell)
Shows service Name, DisplayName, and Status (Running / Stopped).
Example: Get-Service -Name Spooler, wuauserv
Start-Service
Start a Stopped Service Admin
Starts a service immediately. Use Stop-Service to halt it.
Example: Start-Service -Name Spooler
Restart-Service
Restart a Stuck Service Admin
Stops and starts a service in one step. Add -Force if dependent services must also restart.
Example: Restart-Service -Name Spooler -Force
sc query
Inspect Service State & Exit Codes (CMD)
Classic Service Control tool. Great for checking WIN32_EXIT_CODE when a service fails to start.
Example: sc query Spooler or sc qc Spooler (view binary path)
sc config
Change Startup Type Admin
Note the required space after start=! Options: auto, delayed-auto, demand (manual), disabled.
Example: sc config Spooler start= auto (or PS: Set-Service Spooler -StartupType Automatic)
tasklist /svc
See Which Services Run Inside svchost.exe
Maps each svchost.exe PID to the exact Windows services hosted inside it โ€” essential for CPU/RAM spikes.
Example: tasklist /svc /fi "imagename eq svchost.exe"

03 Task Scheduler CLI

Task Scheduler runs scripts, backups, and maintenance jobs automatically based on time, logon, or system events. Use schtasks in CMD or *-ScheduledTask in PowerShell.

schtasks /query
List All Scheduled Tasks
Displays task names, next run times, and status. Add /v for verbose details (script path & user).
Example: schtasks /query /tn "\BackupJob" /v /fo LIST
schtasks /create
Create a Scheduled Task (CMD) Admin
/tn = task name, /tr = program/script, /sc = schedule (DAILY, ONLOGON, HOURLY), /st = start time.
Example: schtasks /create /tn "DailyCleanup" /tr "C:\scripts\clean.bat" /sc DAILY /st 02:00
schtasks /run
Trigger a Task Immediately
Tests a scheduled task on demand without waiting for its next scheduled trigger.
Example: schtasks /run /tn "DailyCleanup" (use /end to stop)
Register-ScheduledTask
Create a Task in PowerShell Admin
Cleaner than schtasks for complex triggers and PowerShell scripts. Pair with Get-ScheduledTask.
Example: Get-ScheduledTask -TaskName "PSBackup" | Start-ScheduledTask

04 Startup, msconfig, Safe Mode & bcdedit

When Windows fails to boot or slows down at login, these tools control what loads at startup and how the Windows Boot Manager (BCD) behaves.

Quick GUI Consoles (Win+R)

  • Registry Editorregedit
  • Services Consoleservices.msc
  • Task Schedulertaskschd.msc
  • System Configuration (Boot/Startup)msconfig
  • Startup Apps Foldershell:startup

Boot & Safe Mode CLI

  • View Boot Entriesbcdedit /enum
  • Enable Safe Mode (Next Boot)bcdedit /set {current} safeboot minimal
  • Safe Mode + Networkingbcdedit /set {current} safeboot network
  • Return to Normal Bootbcdedit /deletevalue {current} safeboot
  • List Startup Programswmic startup get caption,command
Memory Trick: HKLM = Local Machine (every user on this PC), HKCU = Current User (only me). And for sc config, always remember the space after the equals sign: start= auto (never start=auto)!

05 Danger Zone โ€” Avoid Breaking Windows

Registry, Services, and Boot Configuration changes take effect immediately โ€” there is no "Undo" button in the CLI.

โš ๏ธHigh-Risk Actions to Avoid
1. Editing or deleting HKLM keys without a reg export backup
Running reg delete ... /f on system keys can prevent Windows from booting. Always run reg export <key> backup.reg first so you can restore from WinRE if needed.
2. Disabling critical core services (RpcSs, PlugPlay, DcomLaunch)
Remote Procedure Call (RpcSs) and Plug and Play (PlugPlay) are dependencies for almost all Windows subsystems. Disabling them can lock you out of Device Manager, networking, and Services itself.
3. Forgetting to clear bcdedit /set {current} safeboot or deleting {current}
Setting safeboot persists across reboots until you run bcdedit /deletevalue {current} safeboot. Never run bcdedit /delete {current} โ€” that removes your OS boot entry.