How big are the built-in Windows 11 apps?

[ad_1]

It seems like a simple enough question. For all of the apps that are built into Windows 10 and Windows 11, just how much disk space are they taking up? That question takes a little bit of effort to answer. First, the built-in apps are provisioned into the OS, and we can get a list of them using the “Get-AppxProvisionedPackage -online | Out-GridView” PowerShell command. Here are the results from Windows 11 21H2:

In this, you can see not only the names and versions of each app, but also the install location. Except that install location just points to the manifest XML file, not to the app folder itself. And that location isn’t consistent, as some of those XML files are in an “AppxMetadata” folder while others are in the “real” app install folder. And some use %SYSTEMDRIVE% instead of a hard-coded location. So you need to do a little more work to figure out that “real” install location, before you can calculate the size.

A little bit of PowerShell script later, you can see this:

These are sorted by size in bytes, so we’re making progress — no big surprise that Teams (the consumer version) is at the top of the (current) list, but some of those sizes are just way too small — apps that are only 11K or 12K wouldn’t be able to do anything. So what’s going on? More complications. Apps can be installed in multiple pieces. The selected app above, Microsoft.StorePurchaseApp, has two folders:

So, the real size is 37MB, not 11KB. Great, but how do you generalize that logic? In theory, you could read the manifest and figure out what possible language and resource packages might be installed, look for each of those, and then total up the sizes, but that’s a non-trivial exercise using either API calls or interpreting the app manifest XML directly. Fortunately, we can take advantage of an assumption: All the folders will be at the same level, and all wills tart with the package DisplayName, so we can use that display name to find all folders that start with that. It’s a bit of a hack, but sometimes that’s all that’s needed.

Now we’re talking. (Technically, this output isn’t 100% correct as there is one app, MicrosoftWinows.Client.WebExperience, that has a file path that is too long for PowerShell 5.1 to fully process. But that’s a rounding error, so I’ll ignore that one.) So what’s the grand total sum of all apps?

Roughly, 1.6GB worth of apps (decompressed, so that’s probably only 800MB or so in a WIM image). I would judge some of those apps as “not worth the bits that they are taking up,” so you might seriously want to consider removing some of those.

Here’s the PowerShell script (also attached below in a zip file, so you don’t have to worry about lines wrapping) if you want to try this yourself:

Get-AppxProvisionedPackage -online | % {
	# Get the main app package location using the manifest
	$loc = Split-Path ( [Environment]::ExpandEnvironmentVariables($_.InstallLocation) ) -Parent
	If ((Split-Path $loc -Leaf) -ieq 'AppxMetadata') {
		$loc = Split-Path $loc -Parent
	}
	# Get a pattern for finding related folders
	$matching = Join-Path -Path (Split-Path $loc -Parent) -ChildPath "$($_.DisplayName)*"
	$size = (Get-ChildItem $matching -Recurse -ErrorAction Ignore | Measure-Object -Property Length -Sum).Sum
	# Add the results to the output
	$_ | Add-Member -NotePropertyName Size -NotePropertyValue $size
	$_ | Add-Member -NotePropertyName InstallFolder -NotePropertyValue $loc
	$_
} | Select DisplayName, PackageName, Version, InstallFolder, Size

Attachment: Get-AppSizes.zip



[ad_2]
Source link

Share this post via

Leave a Reply