PSResourceGet
PSResourceGet copied to clipboard
Unstall-PSResource does not uninstall dependencies
Prerequisites
- [X] Write a descriptive title.
- [X] Make sure you are able to repro it on the latest released version
- [X] Search the existing issues.
Steps to reproduce
When uninstalling a module (ModuleA) which has a dependency on another module (ModuleB) and no other module depends on ModuleB, ModuleB is not uninstalled when uninstalling ModuleA.
Repro:
# I first make sure I don't have any Az* modules installed
Get-Module Az* -ListAvailable
# Installing Az.Storage will also install Az.Accounts
Install-PSResource Az.Storage -TrustRepository
# Confirm I now have Az.Storage and Az.Accounts installed
Get-Module Az* -ListAvailable
# Now uninstall Az.Storage
Uninstall-PSResource -Name Az.Storage
# Az.Accounts is still installed altho nothing is depending on it and I have not explicitly installed it
Get-Module Az* -ListAvailable
Expected behavior
If I install a module that comes with a set of dependencies, I would expect those dependencies to be uninstalled with the module or at least that I'm informed about them being left behind.
I realise there might be scenarios where removing dependencies might be unwanted, like if I explicitly have installed the dependency. Maybe that could be solved with an opt-in solution like a -IncludeDependency parameter.
Actual behavior
Only the module I uninstall is removed, not any of the dependencies.
Error details
No response
Environment data
Get-Module Microsoft.PowerShell.PSResourceGet
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Binary 0.5.23 beta23 Microsoft.PowerShell.PSResourceGet {Find-PSResource, Get-InstalledPSResource, Get-PS…
$PSVersionTable
Name Value
---- -----
PSVersion 7.3.4
PSEdition Core
GitCommitId 7.3.4
OS Darwin 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:23 PDT 2023; root:xnu-8796…
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0