Windows Troubleshooting

75 phút

Windows Troubleshooting

Windows Troubleshooting

Common Windows Issues

Blue Screen of Death (BSOD)

Common Stop Codes:
- CRITICAL_PROCESS_DIED: System file corrupted
- IRQL_NOT_LESS_OR_EQUAL: Driver issue
- MEMORY_MANAGEMENT: RAM issue
- INACCESSIBLE_BOOT_DEVICE: Boot config issue
- PAGE_FAULT_IN_NONPAGED_AREA: Driver/memory
- SYSTEM_SERVICE_EXCEPTION: System file/driver
- DPC_WATCHDOG_VIOLATION: Driver timeout
- KERNEL_SECURITY_CHECK_FAILURE: Corrupted driver

BSOD Troubleshooting

# Check minidumps
Get-ChildItem "C:\Windows\Minidump"

# Read dump file
# Dùng BlueScreenView, WinDbg

# Check reliability
perfmon /rel

# System File Checker
sfc /scannow

# DISM
DISM /Online /Cleanup-Image /CheckHealth
DISM /Online /Cleanup-Image /ScanHealth
DISM /Online /Cleanup-Image /RestoreHealth

# Check disk
chkdsk C: /f /r

# Test memory
mdsched.exe

Safe Mode

Truy cập Safe Mode:
1. Shift + Restart
2. Troubleshoot → Advanced → Startup Settings → Restart
3. Chọn 4 (Safe Mode) hoặc 5 (Safe Mode with Networking)
4. Hoặc F8 (older Windows)

Trong Safe Mode:
- Uninstall problematic driver
- Remove recent software
- Run virus scan
- System Restore

Windows Performance Issues

Slow Performance

# Check startup programs
Get-CimInstance Win32_StartupCommand | 
    Select Name, Command, Location

# Disable startup via Task Manager
taskmgr → Startup tab

# Check disk usage
Get-PSDrive C | Select Used, Free

# Check CPU/Memory
Get-Process | Sort CPU -Desc | Select -First 10
Get-Process | Sort WS -Desc | Select -First 10

# Check services
Get-Service | Where Status -eq "Running"

Solutions

1. Disable unnecessary startup programs
2. Uninstall bloatware
3. Run Disk Cleanup
   cleanmgr
4. Defragment HDD
   defrag C: /O
5. Disable visual effects
6. Increase RAM
7. Upgrade to SSD
8. Malware scan
9. Windows Update
10. Reset Windows (last resort)

Windows Update Issues

Common Problems

- Update stuck at X%
- Failed to install (Error 0x800...)
- Update loop
- Update broke system
- Cannot connect to update server

Troubleshooting

# Check update status
Get-WindowsUpdateLog

# Stop update services
Stop-Service -Name wuauserv, cryptSvc, bits, msiserver

# Rename folders
Rename-Item "C:\Windows\SoftwareDistribution" SoftwareDistribution.old
Rename-Item "C:\Windows\System32\catroot2" catroot2.old

# Start services
Start-Service -Name wuauserv, cryptSvc, bits, msiserver

# Reset Windows Update components
net stop wuauserv
net stop cryptSvc
net stop bits
net stop msiserver
ren C:\Windows\SoftwareDistribution SoftwareDistribution.old
ren C:\Windows\System32\catroot2 Catroot2.old
net start wuauserv
net start cryptSvc
net start bits
net start msiserver

WSUS Reset Script

@echo off
echo Resetting Windows Update components...
net stop bits
net stop wuauserv
net stop appidsvc
net stop cryptsvc

Del "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\*.*" /f /q /s
Del "%SystemRoot%\SoftwareDistribution\Download\*.*" /f /q /s

regsvr32.exe /s atl.dll
regsvr32.exe /s urlmon.dll
regsvr32.exe /s mshtml.dll
regsvr32.exe /s shdocvw.dll
regsvr32.exe /s browseui.dll
regsvr32.exe /s jscript.dll
regsvr32.exe /s vbscript.dll
regsvr32.exe /s scrrun.dll
regsvr32.exe /s msxml.dll
regsvr32.exe /s msxml3.dll
regsvr32.exe /s msxml6.dll
regsvr32.exe /s actxprxy.dll
regsvr32.exe /s softpub.dll
regsvr32.exe /s wintrust.dll
regsvr32.exe /s dssenh.dll
regsvr32.exe /s rsaenh.dll
regsvr32.exe /s gpkcsp.dll
regsvr32.exe /s sccbase.dll
regsvr32.exe /s slbcsp.dll
regsvr32.exe /s cryptdlg.dll
regsvr32.exe /s oleaut32.dll
regsvr32.exe /s ole32.dll
regsvr32.exe /s shell32.dll
regsvr32.exe /s initpki.dll
regsvr32.exe /s wuapi.dll
regsvr32.exe /s wuaueng.dll
regsvr32.exe /s wuaueng1.dll
regsvr32.exe /s wucltui.dll
regsvr32.exe /s wups.dll
regsvr32.exe /s wups2.dll
regsvr32.exe /s wuweb.dll
regsvr32.exe /s qmgr.dll
regsvr32.exe /s qmgrprxy.dll
regsvr32.exe /s wucltux.dll
regsvr32.exe /s muweb.dll
regsvr32.exe /s wuwebv.dll

net start bits
net start wuauserv
net start appidsvc
net start cryptsvc

echo Done!
pause

User Profile Issues

Common Issues

- Temporary profile loaded
- Profile corruption
- Cannot log in
- Settings not saving
- Desktop files missing
- Slow login

Troubleshooting

# Check profiles
Get-CimInstance Win32_UserProfile

# View profile list
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"

# Backup registry before modifying
reg export "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" `
    profilelist.reg

# Remove corrupted profile
# 1. Reboot (may log in with temp profile)
# 2. Log in as admin
# 3. Backup user data (C:\Users\username)
# 4. Delete profile via Advanced System Settings
# 5. Remove from ProfileList registry
# 6. Reboot and login again

Application Issues

Common Problems

- App won't start
- App crashes
- App runs slow
- Missing components
- License issues
- Compatibility

Troubleshooting

# Check event logs
Get-EventLog -LogName Application -EntryType Error -Newest 20

# Compatibility mode
# Right-click → Properties → Compatibility

# Run as administrator
Start-Process "app.exe" -Verb RunAs

# Check dependencies
# Visual C++ Redistributable
# .NET Framework
# Java Runtime

# Reinstall app
# Use Revo Uninstaller for complete removal

# Check for updates

# SFC for system files
sfc /scannow

Network Sharing Issues

File Sharing

# Check network discovery
Get-NetFirewallRule -DisplayGroup "Network Discovery"

# Enable sharing
Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" `
    -Enabled True

# Check share
Get-SmbShare
New-SmbShare -Name "Data" -Path "D:\Data" `
    -FullAccess "Domain Admins" `
    -ChangeAccess "Domain Users"

# Check permissions
Get-SmbShareAccess -Name "Data"
icacls "D:\Data"

# Enable sharing on network
# Control Panel → Network and Sharing Center
# → Advanced sharing settings

Mapped Drive Issues

# Map drive
net use Z: \\server\share /persistent:yes

# With credentials
net use Z: \\server\share /user:domain\username password

# Disconnect
net use Z: /delete

# View mappings
net use

# GPO mapping (preferred)
# User Config → Preferences → Windows Settings → Drive Maps

Windows Recovery

System Restore

# Enable System Restore
Enable-ComputerRestore -Drive "C:\"

# Create restore point
Checkpoint-Computer -Description "Before major change" `
    -RestorePointType "MODIFY_SETTINGS"

# List restore points
Get-ComputerRestorePoint

# Restore
Restore-Computer -RestorePoint 5

Reset Windows

Windows 10/11:
Settings → Update & Security → Recovery
→ Reset this PC

Options:
- Keep my files: Remove apps, keep user data
- Remove everything: Clean install

Advanced:
- Restore from cloud
- Restore locally
- Change settings (clean data?)

Boot Repair

# Boot from Windows installation media
# Press Shift+F10 for command prompt

# Check disk
chkdsk C: /f /r

# Rebuild BCD
bootrec /fixmbr
bootrec /fixboot
bootrec /scanos
bootrec /rebuildbcd

# Repair boot
bcdedit /enum
bcdboot C:\Windows /s C:

Windows Tools

Event Viewer

Windows Logs:
- Application
- Security
- Setup
- System
- Forwarded Events

Applications and Services Logs:
- Microsoft
- Windows
- Custom

Filter:
- Level: Critical, Error, Warning, Info
- Source
- Event ID
- Date range

Performance Monitor

# Open perfmon
perfmon

# Data Collector Sets
# Custom counters

# Key counters:
Processor(_Total)\% Processor Time
Memory\Available MBytes
PhysicalDisk(_Total)\% Disk Time
Network Interface\Bytes Total/sec

Reliability Monitor

perfmon /rel

# Xem:
- Application failures
- Windows failures
- Misc failures
- Warnings
- Information

Bài tập thực hành

Hãy troubleshoot các sự cố Windows!

Bài tập 1