To remove APPX packages, Remove-AppxPackage is the best and only one reliable command. Another way is to remove/delete the installed files of that app. Remember this procedure does not (and never will) truly uninstall that APPX package.
At first, find folders containing the APPX name (e.g. for "Weather" it will be "Microsoft.BingWeather") in the following directories:
C:\Program Files\WindowsApps\
C:\Users\<user_name>\AppData\Local\Packages\
C:\Windows\InfusedApps\Applications\
C:\Windows\InfusedApps\Packages\
Then make a batch file with the following commands and run it as administrator. Then enter the folders full path containing the appx name. Be cautious when you enter folder path, it should have the Appx name at last.
@echo off
set /p X=Enter Directory path:
takeown /F %%X /R /D Y
icacls %%X /grant Everyone:F /T
rd /S /Q %%X
pause
Further reading:
- takeown command
- icacls command
- Microsoft Answer: WindowsApps folder
Using Terminal to Fully Delete Applications
windows - Uninstall and Install App on my Computer silently - Stack Overflow
how to uninstall a program using CMD or Power Shell ?
batch file - Is there any Windows command to uninstall an application? - Stack Overflow
Videos
Hey guys, I was wondering if there was a way to remove an app fully with Terminal? Whenever I try to remove app and reinstall it with a new version with terminal it's the same old version but a higher size. Can anyone tell me what I am possibly doing wrong?
No Silver Bullet
There is no silver bullet when it comes to automating installation or uninstallation - but there is a quick trick that is described in the "General Uninstall" section.
There are heaps of different flavors of installer types - and the list keeps growing. Automating them is a bit of a black art as you will be fully aware of. Not rocket science, but tedious and tiresome when things don't work reliably and there is no suitable remedy that consistently works all the time.
I have written about these issues many times before and cross-linked the content very heavily. It is messy, but if you follow the links and web of linked pages below you should be able to find the information you need for many different setup.exe and installer types.
General Uninstall
Before going into the below ad-hoc list of different types of installers / uninstallers and how to handle their command line parameters. I want to add that you can find a list of most of the products installed on the system in these registry locations:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall(64-bit)HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall(32-bit)HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall(per-user)
By checking for UninstallString or equivalent for a specific entry under these parent keys, you can get a general idea of how to uninstall the product in question by command line.
Try this simple approach first, but do read the material below for a better understanding of how installers of various kinds operate. Not all deployment tools and deployment operations register properly in these locations.
Apps are not found in these locations in the registry, only MSI installers (Windows Installer) and some - or most - of legacy setup.exe installers.
Installer Types & Uninstall (and extract for setup.exe)
- "Unattended.com": The easiest and quickest read on the topic of automating install / uninstall could be this one: http://unattended.sourceforge.net/installers.php
- This is aging content, but I remember it as helpful for me back in the day.
- And crucially it is not my own content - so I don't link entirely to myself! :-) (most of the links below are earlier answers of mine). Apologizes for that - it is just easier to remember your own content - you know it exists - and it is easier to find.
- MSI: The most standardized packages to deal with are MSI packages (Windows Installer).
- They can be installed / uninstalled in a plethora of reliable ways: Uninstalling an MSI file from the command line without using msiexec. The most common approach is to use the
msiexec.execommand line (section 3 in the linked answer). Do read this answer please. It shows the diverse ways Windows can invoke an install / uninstall for MSI files (command line,automation,Win32,.NET,WMI,Powershell, etc...) - Though complicated Windows Installer has a number of corporate benefits of major significance compared to previous installation technologies. Standardized command line and suppressible GUI for reliable install / uninstall are two of the most important benefits.
- The standard msiexec.exe command line
- How can I find the product GUID of an installed MSI setup?
- They can be installed / uninstalled in a plethora of reliable ways: Uninstalling an MSI file from the command line without using msiexec. The most common approach is to use the
- Setup.exe: Installers in setup.exe format can be just about anything, including wrapped MSI files (Windows Installer). For MSI files wrapped in setup.exe files you can use the previous bullet point's standard mechanisms to uninstall (they are registered by product code GUID). Below are some links on how to extract the content of setup.exe files for various types of setup.exe files and also links to pages documenting the actual
setup.execommand line parameters:- General Links: There is some information on how to deal with different types of setup.exe files here: Extract MSI from EXE
- Installshield: is a tool used to create setups of both legacy and modern MSI types. It delivers setup.exe files that are actually in many different formats and some with differing command line switches.
- There is a description of Installshield setup.exe peculiarities here
- Here is the official documentation for Installshield setup.exe files
- Here is a simple explanation of setup.exe extraction for Installshield setup.exe files
- Wise: was another important tool that is now off market. Many Wise-compiled setup.exe files are still in use. Here is a brief overview of Wise switches
- Advanced Installer: is a current tool used by many to make setup.exe / installers. http://www.advancedinstaller.com/user-guide/exe-setup-file.html
- WiX: this is an Open Source toolkit used to compile MSI files and setup.exe files / installers. It is quite common to encounter WiX-compiled files.
- WiX installers can be in standard Windows Installer format such as MSI, MSP, etc... In this case use the options listed in bullet point 2 to deal with them.
- There is also a way to compile
setup.exefiles with WiX. I only know of this "unofficial list" of switches to link to. The basic uninstall format is:setup.exe /uninstall /passive /norestart - You can also open a command prompt and go
setup.exe /?to get a list of parameters for WiX (and other)setup.exefiles. - There is also a WiX tool that can be used to decompile MSI files and also to decompress a WiX setup.exe file. See relevant section here: How can I compare the content of two (or more) MSI files?
- Other Tools: There are many tools that can be used to create installers / setup.exe files. Here are some of the bigger ones (just FYI - no command line switches to find here, just product information):
- Non-MSI installer tools: http://www.installsite.org/pages/en/tt_nonmsi.htm
- Windows installer tools: http://www.installsite.org/pages/en/msi/authoring.htm
- Sys-admin tools for deployment: http://www.installsite.org/pages/en/msi/admins.htm
- This may also be of help: Wix - How to run/install application without UI
- Apps: And there is the whole new world of apps.
- How to silent install an UWP appx?
- Add-AppxPackage
- Remove-AppxPackage
- Install UWP apps with App Installer
- Install Windows Store App package (*.appx) for all users
- Install package (appxbundle) via .appinstaller to all users on machine
- How to silent install an UWP appx?
Other Links:
- How to create windows installer
I figured it out myself and it works for many projects which have .exe setups. Following is the format 1. Open terminal with admin rights 2. go to path in where setup that you used to install the product. 3. Once there then type: setupname.exe /uninstall /q
I need to use a script with either CMD or Power Shell to uninstall a program from a windows machine.
To be clear , I already know how to use the “wmic” & "Get-WmiObject -Class Win32_Product ", what I am looking for is how to remove the programs listed under Programs & Feature in control panel but doesn’t show up when using WMIC (Product Get Name) or (Get-WmiObject -Class Win32_Product) commands.
I can use these script easily:
1. CMD:
wmic
product get name
product where name=“program name” call uninstall
2. Power Shell:
$app = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -match “Software Name” } >> $app.Uninstall()
Both scripts above helped me remove specific programs only, but the list I have under control panel still have lots of other applications that I am hoping to use similar script to remove them.
Any idea / suggestion is highly appreciated ?
If the application was installed by MSI, and if you know the GUID, you can use msiexec to uninstall the application. That is the most efficient way, provided that the prerequisites are true.
Win32_Product is very inefficient.
Scripting Blog [archived] – 13 Nov 11
Use PowerShell to Quickly Find Installed Software - Scripting Blog [archived]
Summary: Learn how to use Windows PowerShell to quickly find installed software on local and remote computers. Microsoft Scripting Guy Ed Wilson here. Guest Blogger Weekend concludes with Marc Carter. The Scripting Wife and I were lucky enough...
Scripting Blog [archived] – 14 Dec 11
Use PowerShell to Find and Uninstall Software - Scripting Blog [archived]
Summary: Learn how to use Windows PowerShell to get software installation locations, and to uninstall software from remote computers. Hey, Scripting Guy! We have a dumb application that we have to use at work. The company has released a new version...
Long story short, I tried to install Retrodeck but something didn't go right and now it's causing the Discover app to crash when I try to view my installed apps. And it throws this error when I open Discover
Error updating appstream2: No such ref 'appstream2/x86_64' in remote retrodeck-origin: Error updating appstream: No such ref appstream/x86_64' in remote retrodeck-origin
The app got installed and I launched it in Desktop mode. I don't really want to use it anymore so wanna uninstall, but I can't via Discover.
Anyone know the command to get a list of all installed apps and the the command to uninstall it? I'm having trouble finding it online.
I tried to install the new Catalina update, and I guess it didn't have enough space (it didn't say, it started the update process). I don't think it finished, and now I can't get past my login screen without my Macbook (Pro, 2015) shutting down. I've tried everything, and all I can think to do is free up space and re-install Catalina through recovery mode.
I need to free up 4 more gbs of space. I can't get to my applications folder, since I can't log in, so I was wondering how can I use the terminal to do it? I was going to delete my Adobe applications, but when I've followed instructions to get into my Applications folder path, I don't see any of the apps.
Any help/advice would be very appreciated. I really don't wanna have to wipe my drive.
This isn't built into OSX, but a guy wrote a cli tool called trash that is cross platform and is intended as a safe alternative to rm. As it seems it should, it moves the target to the trash rather than deleting it immediately.
There is more information and instructions on how to install at the trash github page
It is not recommended to use the rm method since you can mistakenly remove wrong file and it is no longer in trash.
But if you must:
Instructions
Type
sudo rm –f(with a space after the f and not including the quotes) to delete a file.Type
sudo rm –rfto delete a folder.Drag and drop the files you wish to delete onto the open Terminal window. The files you drop on the Terminal window will be deleted. You can drag and drop multiple files and folders onto the Terminal window.
Read more: http://www.ehow.com/how_4530950_delete-terminal-mac-os-x.html#ixzz324fT3H5z
YOU HAVE BEEN WARNED !
Hello all, Not directly power shell but this is the closest sub I could find that may be able to help. I am trying to uninstall a program and clean up afterwards by deleting the associated folders, but running into issues when combining all the commands as a script.
What I have so far is:
-
@ECHO OFF
-
Net stop tripwireAxonAgent
-
Wmic
-
product where name="Axon Agent" call uninstall /nointeractive
-
Quit <=(here is where I have the issue)
-
RMDIR /s /q "C:\ProgramData \Tripwire\Agent"
-
Pause
My main issue is after the product uninstall via WMIC, it will not exit that prompt and remains inside the subsection for it. I’ve tried “quit” “exit” and CD back to the default c:\windows but any command I enter says “syntax error” and just puts the command to delete the directory on screen and freezes the screen.
If I run the commands by themselves, there is no issue and it completes without a problem.
What am I missing / not doing properly. Any help is appreciated.
Also, for reference, I used WMIC to uninstall the program because the MSI the vendor was telling me to use was consistently giving me errors saying “ a product is already installed. You cannot install this version.” or I would get an error saying “ the product is not installed”
Would it be easier to switch this over to power shell to complete the task? I did not originally use power shell because the vendor said there may be issues when using it.