Back to CerebralDatabank's Blog

# Some standard Windows troubleshooting methods

This is mostly for my reference, but I'll put it here in case it helps someone. For most of these commands, you will need administrator privileges. To open PowerShell (recommended) or the standard Windows command prompt as an administrator, type pwsh (the new PowerShell Core), powershell (legacy PowerShell), or cmd in the Search box and press Ctrl + Shift + Enter.

FILEPATH in the commands below should be replaced by the file or folder path you want to perform the operation on. Examples include: "C:\Users\Awesome User\Documents\Test File.txt", "C:\Program Files\WindowsApps", .\SubfolderOfCurrentWorkingDirectory, * (all items in current working directory (the file path before the command prompt))

## Run the System File Checker (SFC)

        
sfc /scannow



## Clean up the current image with the Deployment Image Servicing and Management Tool (DISM)

Use /ScanHealth instead of /RestoreHealth to scan for errors but not fix them.

        
DISM /Online /Cleanup-Image /RestoreHealth



## Force-terminate a running process

FILEPATH should be the name of the executable (e.g. explorer.exe). Omit /f to send a normal shutdown signal (SIGTERM) to the process instead of forcefully terminating it. If you killed the Explorer process, simply run explorer.exe to start it up again.

        



## Take ownership of a file or folder, recursively

Omit /r to not apply permissions recursively.

        
takeown /r /f FILEPATH



## Register/Unregister a DLL file

FILEPATH should be the path to a DLL file (*.dll). Add /u after regsvr32 to unregister the DLL instead of registering it.

        
regsvr32 FILEPATH



## Re-register Microsoft Store apps

Run the below command in PowerShell (you may need to use legacy PowerShell (powershell.exe) instead of the new PowerShell Core (pwsh.exe)). Omit -AllUsers to re-register apps for the current account only.

        
Get-AppxPackage -AllUsers | ForEach-Object {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppxManifest.xml"}



## Reset Access Control List (ACL) data for a file or folder, recursively

An example use case for this is if you took ownership of a folder to view its contents, and you need to set the owner back to NT SERVICE\TrustedInstaller, NT AUTHORITY\System, or whatever else it was before.

Omit /t to not apply permissions recursively, add /q to suppress output for successful operations, and/or omit /c to stop instead of continuing when an error is encountered.

        
icacls FILEPATH /reset /t /c



## List drivers installed for an image (a disk volume)

IMAGELETTER is the drive letter in which Windows is installed (e.g. C). This can also be used from the Windows Recovery Environment command prompt (make sure you use the system drive letter; you can check by using dir to see if it has the Windows, Program Files, etc. folders.

Omit /Format:Table to display in the normal format (key-value details about each driver with extra newline after each driver)

(This helped me when the update Advanced Micro Devices, Inc. - SCSIAdapter - 9.3.0.221 rendered my PC unbootable, even in Safe Mode, and Startup Repair failed to fix the problem.)

        
DISM /Image:IMAGELETTER:\ /Get-Drivers /Format:Table



## Remove an installed driver for an image (a disk volume)

IMAGELETTER is the drive letter in which Windows is installed (e.g. C). DRIVERFILENAME is the driver file name (e.g. oem10.inf), which can be obtained from the "get drivers" command above. This can also be used from the Windows Recovery Environment command prompt (make sure you use the system drive letter; you can check by using dir to see if it has the Windows, Program Files, etc. folders.

Omit /Format:Table to display in the normal format (key-value details about each driver with extra newline after each driver)

(This helped me when the update Advanced Micro Devices, Inc. - SCSIAdapter - 9.3.0.221 rendered my PC unbootable, even in Safe Mode, and Startup Repair failed to fix the problem.)

        
DISM /Image:IMAGELETTER:\ /Remove-Driver /Driver:DRIVERFILENAME



## Generate HTML battery health report

Run the command and open the HTML file (it tells you the file's location after it's done) in the browser of your choice.

        
powercfg /batteryreport



## Generate HTML WLAN report

Run the command and open the HTML file (it tells you the file's location after it's done) in the browser of your choice.

        
netsh wlan show wlanreport