Sub topic 17
Registry Editor and Windows Defender Firewall Console
This chapter assumes you can open an elevated Command Prompt and use the Microsoft Management Console (MMC) from earlier chapters. It covers two tools: Registry Editor for low-level settings, and the Windows Defender Firewall console for traffic rules.
Registry Editor: hives, keys, and safe editing
The registry is a hierarchical database that holds Windows and application settings. Start Registry Editor by pressing Win+R and running regedit. It needs administrator rights to change most keys.
Hives and keys
The left pane shows five root keys. Two are real hives stored on disk, and three are shortcuts or views.
| Root key | Abbreviation | Holds |
|---|---|---|
| HKEY_LOCAL_MACHINE | HKLM | Settings for the whole computer, such as hardware, services, and installed software |
| HKEY_CURRENT_USER | HKCU | Settings for the signed-in user |
| HKEY_CLASSES_ROOT | HKCR | File type associations and COM registration (a merged view) |
| HKEY_USERS | HKU | Loaded profiles for every user on the system |
| HKEY_CURRENT_CONFIG | HKCC | The current hardware profile (a link into HKLM) |
A key is like a folder and can contain subkeys. A value is a named setting inside a key. Common value types are REG_SZ (text), REG_DWORD (a 32-bit number), and REG_MULTI_SZ (a list of strings).
Editing safely
Wrong edits can stop Windows from starting, so follow this order:
- Back up first. Right-click a key and choose Export to save a
.regfile, or create a restore point. - Change only the value you need.
- Restart the app or the PC if required.
- To undo, double-click the exported
.regfile and confirm the merge.
Windows Defender Firewall console
The basic Windows Defender Firewall page in Control Panel only turns the firewall on or off and allows apps through. For detailed rules, open the advanced console by running wf.msc. Its full name is Windows Defender Firewall with Advanced Security.
Rule types
- Inbound rules control traffic arriving at the computer. Windows blocks inbound traffic by default unless a rule allows it.
- Outbound rules control traffic leaving the computer. Windows allows outbound traffic by default unless a rule blocks it.
- Connection security rules require authentication or encryption between computers.
A rule can match a program, a port, a predefined service, or a custom set of conditions. Each rule has an action: allow, allow only if the connection is secure, or block. You can also apply a rule to the Domain, Private, or Public network profile.
Common errors
- Opening a port in the wrong profile, so the rule does not apply on the network in use.
- Disabling the firewall to "fix" a connection problem, which removes protection. Create a narrow allow rule instead.
- Blocking a port that the application needs.
Exercise
A technician must change a registry value under HKLM, and the change might stop a service from starting. What should the technician do before editing, and how can the change be reversed?
Show answer
Export the key to a .reg file (or create a restore point) before editing. To reverse the change, double-click the exported .reg file and confirm the merge, or restore from the restore point.
Exercise
A user's file-sharing app cannot receive connections, but it works when the firewall is off. Which console do you open, and what do you create?
Show answer
Open wf.msc (Windows Defender Firewall with Advanced Security) and create an inbound rule that allows the app's program or port, applied to the correct network profile.