Showing posts with label Windows 11. Show all posts
Showing posts with label Windows 11. Show all posts

29/10/2025

Get Windows Capabilities - Powershell

Recently I came across very useful PowerShell cmdlet to manage windows OS.

It is called Get-WindowsCapability




It is part of DISM module (the tool we discussed in last blog post).

In order to see all available capabilities (features), you can run following:

Get-WindowsCapability -Online

This shows, component along side with status (whether it is installed on current system or not)

E.g.

Name  : Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0

State : NotPresent


Name  : Microsoft.Windows.WordPad~~~~0.0.1.0

State : Installed


Capabilities can be categorized to several categories:
  • .NET Framework 3.5
  • RSAT tools (e.g. Active Directory, DHCP)
  • Language packs
  • OpenSSH Client/Server
  • WordPad, PowerShell ISE, etc.

In the list category is shown as the first part of the name.

If you want to search for specific capability, you can do it using following PowerShell command:

Get-WindowsCapability -Online | Where-Object Name -like "*OpenSSH*"

If you want to installed a capability, you need to use a different cmdlet called "Add-WindowsCapability"

Add-WindowsCapability -Online -Name "OpenSSH.Server~~~~0.0.1.0"

If you want to un-install a capability:

Remove-WindowsCapability -Online -Name "Microsoft.Windows.WordPad~~~~0.0.1.0"

This is very handy way to install components, when you are in a hurry.

Reclaiming Disk Space Safely - Method 1

I was cleaning up my old laptop (which my daughter is using now) and it was severely lacked disk space to operate. I tried conventional ways and able to get some space, but was not enough.

Analyzing the system, I could see there are there are several iteration of windows updates and multiple version of windows components are there. Most of these components are stored in WinSxS folder. Looking at the size of this folder, I could see it is huge.

WinSxS -> short name for Windows Side-by-Side.

How do I clean-up this folder? It was too risky to manually delete stuff in here as it is windows system component folder. There fore I turned to ChatGPT (in old days it would have been Google), to find the answer.

One of the suggestion by ChatGPT was to use dism command line tool.



What is dism command line tool?

DISM -> Deployment Image Servicing and Management. DISM can do lot more than cleaning up WinSxS folder. If you need to know more about it read this article from Microsoft.

You can use following command to analyze the component store:

Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore

You will see output similar to below:

Component Store (WinSxS) information:

Windows Explorer Reported Size of Component Store : 9.17 GB

Actual Size of Component Store : 8.70 GB

    Shared with Windows : 4.04 GB

    Backups and Disabled Features : 4.66 GB

    Cache and Temporary Data :  0 bytes

Date of Last Cleanup : 2025-10-29 02:50:09

Number of Reclaimable Packages : 8

Component Store Cleanup Recommended : Yes

The operation completed successfully.


When you are ready to clean-up, run following command:

Dism.exe /Online /Cleanup-Image /StartComponentCleanup

If your system is stable and you are sure, you don't need to rollback any components add "resetbase" option to above command to clean-up further.

Dism.exe /Online /Cleanup-Image /StartComponentCleanup /resetbase

But after resetting, you will not be able to un-installed already installed updates.



17/06/2024

Shut It Down Correctly

My new (newish but used, provided by company) Windows 11 laptop keeps drains it's battery even when I shut it down from the Windows Shut Down menu (I turn the wall plug off so battery doesn't keep (trickle) charging over night).

I tried several power settings, but wasn't able to fix it. I wanted it to shut down properly and save battery. I didn't want it to startup quickly, I'm not in a hurry to start it up.

So I start searching for solutions.

That's when I found out Windows 11 hibernate mode and Fast Startup.

When hibernate mode is enabled, even when you shut down the computer from Shut Down menu, it goes to hibernate state, i.e. it will consume power to keep settings on the memory.

Fast Startup, which is another feature in Windows 11, will also make more battery to consume, even though you shut down your computer.

You need to turn off both these options to make it correctly shut down (which I wanted to do).

Turning of Fast Startup

1. Window Search bar (on start menu) type "Control Panel"

2. Control panel, choose "Hardware and Sound"

3. Under "Power Options", choose "What the power button does"
4. Click on "Change settings that are currently unavailable" link.
5. You will see a option called "Turn on Fast startup (recommended)" option. If it is ticked, un-tick it.
6. Save your settings.

Turn off Hibernate mode

1. Open command line (or terminal) under "Administrator"
2. Type following and press enter
         powercfg -h off

Turning off these two will make laptop to shut down properly.

While you are worry about battery, if you need to see very detail report about battery, you can do this by running following command under administrator command line (terminal):
        powercfg /batteryreport /output "C:\battery_report.html"

Note you can change the output path if you wish.




SQL Server Performance Tuning Excersises - 1

Couple of weeks ago, I blogged about how I tried to use AI (Claude) to teach me performance tuning. You can read it here . Starting from thi...