Search This Blog

Wednesday, November 16, 2022

Windows: Maintenance and debloating

Keeping your computer clean on the outside is a good thing, equally important is cleaning up the computer internally as well using software. You might simply not want to go through the steps necessary to reinstall the entire computer so here I list some good commands that you can run in PowerShell as an admin. You can also check my other blog post for some tips and tricks on what you can delete to save space.
 

Commands to run in PowerShell

Run system file checker, this sometimes finds and fixes corrupt system files:
SFC /Scannow

Run the tool for Deployment Image Servicing and Management. Basically these are three levels, the last does a bit of repairing. Run SFC before you run any of the DISM commands:
Dism /online /cleanup-image /checkhealth

Dism /online /cleanup-image /scanhealth

Dism /online /cleanup-image /restorehealth

This command can help you recalibrate your system clock. I found it helpful when syncing the clock on computers with a bad battery when internet access have been stopped either by a VPN or because the web browser notices an all too big of a time change. 
Simply run this command to fix the clock:

W32tm /resync /force

In order to fix basic network issues you can run the following commands in this order, the second will disconnect your from the internet usually.

Ipconfig /flushdns

Ipconfig /release

Ipconfig /renew

When changes have been made to the group policy you can try this command to force an update. Pay attention to what settings that override which as well so that you aren't waiting for an update that might not show up.

Gpupdate /force

Running this command let's you check the health of your harddisk.
Chkdsk /f

This command will help you to scan your memory for issues (this command is a program that you can call upon):
mdsched.exe

Some programs to run

Apart from these commands that you can run as admin in the PowerShell window, there are a few built-in programs that you find by searching in your start menu. These are just a good habit to run once in a while to do some cleaning:

Disk cleanup
Disk defragmentation
Storage settings (it will list items you can delete as well)
Full Windows virus scan
 

Debloating script

I've also put together a script that runs through basic pre-installed software and removes it. Sometimes I've tried removing every AppxPackage that I could find, but I found things to get a bit buggy. So this script contains apps that you can live without, all in the name of more resources to what you think is important.

# Run as admin

# Silence errors
$ErrorActionPreference = 'SilentlyContinue';

# App list
$applist = "*3dbuilder*","*windowsalarms*","*windowscommunicationsapps*","*windowscamera*",
"*officehub*","*skypeapp*","*getstarted*","*zunemusic*","*windowsmaps*","*solitairecollection*",
"*bingfinance*","*zunevideo*","*bingnews*","*onenote*","*people*","*bingsports*","*soundrecorder*",
"*bingweather*","*xboxapp*","*xbox*","*Microsoft.MixedReality.Portal*","*GetHelp*","*Microsoft.Messaging*",
"*sketch*","*sticky*","*phone*","*sticky*","*photos*","*calc*","*gethelp*","*camera*"

foreach ($app in $applist) {Get-AppxPackage $app | Remove-AppxPackage}
 
The script works by creating a list where every item is a search word related to apps that can be installed in Windows. If it doesn't find the app it will continue to the next object. When it finds an object it passes it through the pipeline to the removal cmdlet.
 
 

1 comment:

  1. Anonymous18/1/23 08:02

    This article has proven to be very helpful to me. Articles as such might be much helpful to you to enhance your knowledge base. You shall learn a lot from this. They provides valuable information.
    Should you feel any interest in visiting the site? The link is given below
    Xiaomi Redmi 10C will be available soon in local market

    ReplyDelete