Situatie
If you suspect that a random outdated app is giving you a headache, you can run the winget command-line tool, which is capable of downloading, installing, and updating apps on your PC. To update most of the apps on your PC (unfortunately, winget cannot update every app), just type or copy the following command:
winget upgrade --all
The winget utility will then start updating your apps one by one. Depending on how many apps need updates, the process can take a while. Just note that you’ll have to stay close to the PC while apps are updated, because some will require manual intervention on your side.
All it takes is copying and pasting a few PowerShell commands
Random network-related problems are par for the course on Windows. I’ve been encountering them more often than I’d like on my handheld PCs, but the following PowerShell commands can solve them in a jiffy in most cases.
For basic troubleshooting type:
ipconfig /all
This will list all your network adapters, both active and inactive, along with various details about your network configuration. This info can be very handy when troubleshooting connectivity issues.
Refreshing your PC’s IP address can often be the only fix you need to solve network issues. However, this can affect any firewall rules set up for your PC’s IP address in your router, so make sure to adjust them afterward. To refresh the IP address, run the following two commands:
ipconfig /release ipconfig /renew
If you’re encountering a “DNS Server Is Not Responding” error on your PC, clearing the DNS cache can often solve it. To clear the DNS cache, run:
ipconfig /flushdns
Resetting the Windows Sockets (Winsock) catalog to default settings and rebuilding the TCP/IP stack can often remedy various network connection issues. To do this, run the following two commands:
netsh winsock reset netsh int ip reset
Then reboot your PC.
Lastly, you can restart your network adapter right from PowerShell, another trick that can fix random connectivity issues. To perform this, first run the ipconfig /all command to find out the name of the active network adapter (or multiple adapters, if you have both Ethernet and Wi-Fi). Once you find out the name of the active adapter, run:
Restart-NetAdapter -Name "The name of the active adapter"
My motherboard has two Ethernet ports that are listed as “Ethernet 3” and “Ethernet 4.” Since the Ethernet 4 adapter is active, I need to type the following:
Restart-NetAdapter -Name "Ethernet 4"
Restarting the adapter only takes a few seconds.
Fix your storage problems
The chkdsk command is super handy
Storage-related issues can trigger all kinds of erratic behaviour on Windows PCs, such as random crashes and freezes followed by a BSOD, slowdowns, error messages, and more. Check Disk (chkdsk) is the first-aid PowerShell command that can often resolve various storage issues. The base chkdsk command scans your storage drives for errors. If no errors are found, you’re fine. If errors are found, you can run the following command:
chkdsk /r
This will fix errors discovered on the disk as well as locate bad sectors and recover readable data. Since chkdsk needs to lock the drive it’s repairing you can use it to repair secondary drives while the PC is active. However, if you want to repair your boot drive, you’ll need to schedule chkdsk to run the next time your PC reboots.
Repair corrupted Windows files
With SFC and DISM commands
Corrupted files can wreak havoc on a Windows PC, even if we’re talking only about one or a few corrupted file instances. Use Windows System File Checker (SFC) to quickly scan and replace corrupted files. To run the tool type:
sfc /scannow
And let it do its thing.
If problems persist, you can run Deployment Image Servicing and Management (DISM), which repairs the Windows image. The catch-all DISM command that should fix most issues is:
DISM /Online /Cleanup-Image /RestoreHealth
This will repair and replace damaged and corrupted files using Windows Update as the repair source, and is the recommended course of action if issues persist even after running sfc /scannow.
List folders taking up the most storage
Find out what to delete to free up your PC’s storage
My previous PC only had a single 500GB SSD that I used as both the boot drive and for installing games, so I had to deal with low storage warnings regularly because the drive was almost always nearly full.
Oftentimes, I was able to free up a good chunk of storage by deleting random subdirectories inside the AppData folder used by apps and games that were taking up multiple gigabytes of space. The command I used to hunt down the folders taking up the storage space was very similar to the following:
Get-ChildItem "path to the location" -Directory | ForEach-Object {
$size = (Get-ChildItem $_.FullName -Recurse -File -ErrorAction SilentlyContinue | Measure-Object Length -Sum).Sum
[PSCustomObject]@{
Folder = $_.FullName
SizeGB = [math]::Round($size / 1GB, 2)
}
} | Sort-Object SizeGB -Descending
All you have to do is replace “path to the location” with the target directory you want to scan. Since the AppData folder is always my first suspect, I usually start the hunt by typing the following location:
"C:\Users\Administrator\AppData"
Once you locate the folder eating up the space, you can go one level deeper and find which subfolders are the real storage sinks. In my case, I’m running the command again, but with the following path:
"C:\Users\Administrator\AppData\Local"
As you can see below, the Packages directory is the worst offender, but a number of other folders are also taking up multiple gigabytes of space. It looks like I’ll have to do some more digging and deleting once I finish writing this piece.
Get rid of Windows bloat
winutil can solve and prevent a number of Windows issues
There’s no denying that the current version of Windows is the most bloated yet. You’ve got a bunch of ads and features you don’t need, along with plenty of background processes and extras that can slow Windows down and cause various issues over time.
Luckily, Windows Utility (winutil) is a fantastic open-source script developed by Chris Titus that you can use to debloat your Windows installation.
Running remote scripts with irm | iex can be risky because it executes downloaded code directly. In this case, winutil is a well-known open-source project made by a trusted developer, but in most cases, you should check the script first and make sure it’s safe to execute before typing it into PowerShell and hitting Enter.
While it’s not a tool for fixing problems per se, it can make your PC run faster and help prevent a bunch of issues from showing their ugly heads in the first place. While it’s recommended to run it on a fresh Windows install, you can use it anytime. All you have to do is run the following command:
irm christitus.com/win | iex
This will launch the program, allowing you to tweak various settings, remove a bunch of unnecessary things, and customize your Windows installation to your liking. The tool is quite robust and includes a ton of features, so I recommend checking out the tutorial video created by the developer (who is also a popular YouTuber), as well as reading our winutil guide.
PowerShell is a super handy Windows utility
Windows PowerShell is a very powerful utility that’s much faster than clicking through a ton of Windows menus. It’s not a miracle worker, but you can use it to solve a ton of common Windows problems simply by running a few relatively short commands.
Leave A Comment?