OneGet / oneget

PackageManagement (aka OneGet) is a package manager for Windows
MIT License
2.38k stars 190 forks source link

Uninstall-Package for "Programs" provider is not working #273

Closed artisticcheese closed 3 years ago

artisticcheese commented 7 years ago

Not sure what I'm doing wrong but when I execute following cmdlet it does not show any errors but package is not being uninstalled either, despite the fact that there is no errors and verbose confirmation of uninstallation. Running it second time proves that package is still there.

PS C:\WINDOWS\system32> get-package -ProviderName Programs | where SwidTagText -match "lenovo" | select -First 1 | uninstall-package -Verbose
VERBOSE: Performing the operation "Uninstall Package." on target "Package 'Lenovo Bluetooth Lock' with version '2.0.1.0407'.".

PS C:\WINDOWS\system32> get-package -ProviderName Programs | where SwidTagText -match "lenovo" | select -First 1 | uninstall-package -Verbose
VERBOSE: Performing the operation "Uninstall Package." on target "Package 'Lenovo Bluetooth Lock' with version '2.0.1.0407'.".
mkarpuk commented 7 years ago

Same thing - tried multiple times with different packages. It's a pity that there is no reaction for such a long time

brywang-msft commented 7 years ago

@jianyunt Can you confirm if the Programs provider currently supports uninstall? Code seems to suggest not, but I wanted to double check.

jianyunt commented 7 years ago

You are right. Programs supports get- only. See https://github.com/OneGet/oneget/blob/master/src/Microsoft.PackageManagement.CoreProviders/ProgramsProvider.cs

megamorf commented 7 years ago

Is there a specific reason why this has only been implemented for the msi provider? Right now I'd have to uninstall a program like this:

$Pkg = Get-Package -Name "CRM.launcher" 
$UninstallCommand = $Pkg.Meta.Attributes['UninstallString']
# "C:\Program Files (x86)\InstallShield Installation Information\{A4F81052-C7EF-454F-9436-9820C125C837}\setup.exe" -runfromtemp -l0x0409  -removeonly --silent
Start-Process -FilePath cmd.exe -ArgumentList '/c', $UninstallCommand -Wait

I've just checked the UninstallString for packages retrieved via the Programs provider and not all of them feature a command that can be used for an unattended removal:

Get-Package -ProviderName Programs -ov pkgs | Sort Name,Version | 
Select Name,@{l="UninstallString";e={$_.Meta.Attributes["UninstallString"]}}

I assume that's the reason why this has been on the backburner so far?

brywang-msft commented 7 years ago

I don't see any technical reason, but I haven't looked into it yet so I could be wrong. At worst, if the program doesn't supply an uninstall command, we can write an error. This feature is currently scheduled for the v1.2.1 release, though there's no hard date.

If possible, please submit any requests for this feature in this thread. Thanks!

megamorf commented 6 years ago

Hey @artisticcheese, have I missed something or why did you close the issue? :O

artisticcheese commented 6 years ago

Nobody did anything for more then a year now on this issue so I thought no point in having it open.

nturnerlivanova commented 2 years ago

Is there a specific reason why this has only been implemented for the msi provider? Right now I'd have to uninstall a program like this:

$Pkg = Get-Package -Name "CRM.launcher" 
$UninstallCommand = $Pkg.Meta.Attributes['UninstallString']
# "C:\Program Files (x86)\InstallShield Installation Information\{A4F81052-C7EF-454F-9436-9820C125C837}\setup.exe" -runfromtemp -l0x0409  -removeonly --silent
Start-Process -FilePath cmd.exe -ArgumentList '/c', $UninstallCommand -Wait

I've just checked the UninstallString for packages retrieved via the Programs provider and not all of them feature a command that can be used for an unattended removal:

Get-Package -ProviderName Programs -ov pkgs | Sort Name,Version | 
Select Name,@{l="UninstallString";e={$_.Meta.Attributes["UninstallString"]}}

I assume that's the reason why this has been on the backburner so far?

I use this:

Get-Package -Name "My Program Name" | Uninstall-Package -Force

Works most of the time