Shell's TechBlabber

…ShelLuser blogs about stuff ;)

Uninstalling build-in Win10 apps that cannot be uninstalled.

Windows 10 provides a lot of multimedia capabilities right out of the box. For example: if you have a webcam then you can fire up the ‘Camera’ application and start using said webcam right away. If you’re more into virtual reality then the ‘Mixed reality portal’ might be fully up your alley.

Heck: Windows 10 even provides out of the box support for an Android telephone; if you want to sent text messages with your phone then you can also use your PC to do it. Amazing!

But what if you don’t have a webcam, VR headset or an Android telephone? What if you don’t want to have all these applications installed?

Well, then you’re out of luck because Windows will refuse to de-install them. Bill knows what’s best for you 😉

Fortunately there’s a solution, and it’s name is PowerShell.

What is PowerShell?

For those of you who are not familiar with it: PowerShell is a Unix-like command line environment which is fully build upon the .NET framework. It provides many commands, usually referred to as Cmdlets (“commandlets”), which are usually small .NET powered programs and which provide access to many of Windows’ inner doings.

For example, wondered what Windows has been doing recently? Why not check its eventlog? What’s what? It would require you to dig deep in the main configuration settings? Actually… you can also right click on the start menu (or press Win-x) where you’ll find an option to open the eventlog viewer. Of course now you only have to find the one you need.

But it can also be done in an easier way. First fire up PowerShell, then enter this command:

PS > Get-EventLog -LogName System -Newest 10

… and you will immediately get the latest 10 system related log entries. Easy, right? Do you wish to filter and concentrate only on optional errors? Couldn’t be easier:

PS > Get-EventLog -LogName System –EntryType Error -Newest 10

And don’t think for a moment that I know all of this stuff from mind (apart from the Get-EventLog cmdlet); I simply entered get-eventl and pressed <tab>. Then I used –log and pressed <tab> again. I didn’t stop there: pressing <tab> once more allowed me to iterate through all the logtypes.

And this is only scratching the surface. PowerShell is basically a systems administrators dreams come true, there’s almost nothing which you can’t do with this.

Windows 10 uses images

Now, before I’m going to explain how to uninstall those programs I’d like to share how I discovered these options. Because knowing a trick is only that: a trick. But knowing how that trick actually works might even help you to discover other tricks all on your own. That is what happened to me at least.

When I was still busy setting up my new PC (installing all the software I had on my previous Windows 7 machine) I eventually ran into a weird problem: there were 2 entries for a certain program in my start menu, one was ‘responsive’ (I could right click and perform certain tasks) but the other didn’t do anything. Even more bizarre: when I uninstalled the program then the “static” entry remained and there was no way to remove it.

So I searched online for a solution and eventually discovered a website which introduced me to the dism.exe command, a program which has been included with Windows since 10 released. I started to dig into this command a bit more and discovered that it’s basically a tool to administer images (.wim files). In its help screen I noticed that: “DISM enumerates, installs, uninstalls, configures, and updates features and packages in Windows images.”. Note ‘packages’?

I dived a bit more into TechNet and learned that programs (or “apps”) are usually provided as “packages”. When you install an app you actually install a package of some sort. And that made me wonder…

Package manager

If all of those entries were referred to as packages then surely PowerShell, the de-facto sysadmin tool, should support this stuff? So I checked:

PS> Get-Command -Name *package* | Measure-Object

Count    : 61
Average  :
Sum      :
Maximum  :
Minimum  :
Property :

So 61 commands (actually a combination of cmdlets and aliases) which were somehow related to packages. Digging through this list I eventually discovered Get-Package and Get-AppPackage (which is actually an alias for Get-AppxPackage).

And what do you know? Get-AppxPackage listed many packages, including those which cannot be removed (according to the apps list and the lack of a remove option in the start menu). A good example is the Windows calculator, try and see for yourself: you cannot uninstall this.

However, PowerShell is pretty clear on this:

PS > Get-AppxPackage -Name *calculator*

Name              : Microsoft.WindowsCalculator
Publisher         : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      : X64
ResourceId        :
Version           : 10.1811.3241.0
PackageFullName   : Microsoft.WindowsCalculator_10.1811.3241.0_x64__8wekyb3d8bbwe
InstallLocation   : C:\Program Files\WindowsApps\Microsoft.WindowsCalculator_10.1811.3241.0_x64__8wekyb3d8bbw
e
IsFramework       : False
PackageFamilyName : Microsoft.WindowsCalculator_8wekyb3d8bbwe
PublisherId       : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False
NonRemovable      : False
Dependencies      : {Microsoft.UI.Xaml.2.0_2.1810.18003.0_x64__8wekyb3d8bbwe, Microsoft.VCLibs.140.00_14.0.26
706.0_x64__8wekyb3d8bbwe, Microsoft.WindowsCalculator_10.1811.3241.0_neutral_split.scale-
125_8wekyb3d8bbwe, Microsoft.WindowsCalculator_10.1811.3241.0_neutral_split.scale-100_8we
kyb3d8bbwe…}
IsPartiallyStaged : False
SignatureKind     : Store
Status            : Ok

Notice the Non-Removable property up there? Its value is False meaning that we should be able to remove this package. And further study showed me the availability of the Remove-AppxPackage cmdlet. Ergo…

Removing applications aka packages

It’s really quite simple. The main thing to realize is that PowerShell is fully object oriented. What that means is that even if you get a bunch of properties (such as displayed above) then you’re still dealing with one individual object.

Allow me to demonstrate:

PS > Get-AppxPackage -Name *calculator* | Select-Object -Property Name

Name
—-
Microsoft.WindowsCalculator

The Select-Object cmdlet can select specific properties of an object. In the above example I selected the Calculator package object, fed it into Select-Object and then told that cmdlet to only display the Name property, the result can be seen above.

So… if you want to uninstall the package then all you have to do is feed the object into a cmdlet which will do that, in this case Remove-AppxPackage.

Be sure to read its help though; you can select between removing the package for the current user only (which is the default) or remove it for all users (which will also remove it from your system). This is done using the –AllUsers parameter. You can even remove this for an individual user, but that’s beyond the scope of this blog post.

So…

To remove the calculator from your system (as an example) you’d use this command:

PS > Get-AppxPackage -Name *calculator* | Remove-AppxPackage –AllUsers

… and you’re done.

So basically:

  • Find the package name using Get-AppxPackage –Name <name>.
    • You can use wildcards to make searching easier.
  • Then if you have the right package feed it into Remove-AppxPackage.
    • Optionally you can use –AllUsers to remove it from the entire system.

Easy right?

More than just a GUI

Windows is much more than just a simple GUI, there’s a whole infrastructure available “under the hood” which allows you to control and administer just about everything. And the key tool for all this, you’ve seen it above, is PowerShell.

Advertisements

February 11, 2019 - Posted by | PowerShell, Tips and tricks, Windows 10

Sorry, the comment form is closed at this time.

%d bloggers like this: