When invoking Find-PSResource with the -IncludeDendencies switch I see different results compared to what Install-PSResource is actually doing.
I'm trying to catch what Install-PSResource would do when our pipeline tries to install a module that is already installed.
I want to clean up old versions (even if this module is already installed) to keep our environment tidy but this requires me to know what Install-PSResource would install. I used to invoke Install-PSResource with the -Reinstall -PassThru switches but the Az modules installs quite a bit of prerequisites so it introduces more chance of pipeline failures (proxy timeouts etc) that I'd rather just check the prerequisites.
Therefore I started using Find-PSResource with the -IncludeDependencies switch, expecting it to give me what I need, but it apparently resolves every dependency of every module and therefore duplicates a Az.Accounts 25 times because a lot of the module apparently specify a different version dependency, but should Find-PSResource not give me back what Install-PSResource would result in though?
Expected behavior
PS C:\Windows\system32> (Find-PSResource -Name Az -IncludeDependencies | Group-Object -Property Name).Where({ $_.Name -eq 'Az.Accounts' })
Count Name Group
----- ---- -----
1 Az.Accounts {Microsoft.PowerShell.PSResourceGet.UtilClasses.PSResourceInfo
PS C:\Windows\system32> (Install-PSResource -Name Az -Scope AllUsers -TrustRepository -Reinstall -PassThru | Group-Object -Property Name).Where({ $_.Name -eq 'Az.Accounts' })
Count Name Group
----- ---- -----
1 Az.Accounts {Microsoft.PowerShell.PSResourceGet.UtilClasses.PSResourceInfo}
Actual behavior
PS C:\Windows\system32> (Find-PSResource -Name Az -IncludeDependencies | Group-Object -Property Name).Where({ $_.Name -eq 'Az.Accounts' })
Count Name Group
----- ---- -----
25 Az.Accounts {Microsoft.PowerShell.PSResourceGet.UtilClasses.PSResourceInfo, Microsoft.PowerShell.PSResourceGet.UtilClasses.PSResourceInfo, Micr...
PS C:\Windows\system32> (Install-PSResource -Name Az -Scope AllUsers -TrustRepository -Reinstall -PassThru | Group-Object -Property Name).Where({ $_.Name -eq 'Az.Accounts' })
Count Name Group
----- ---- -----
1 Az.Accounts {Microsoft.PowerShell.PSResourceGet.UtilClasses.PSResourceInfo}
Prerequisites
Steps to reproduce
When invoking Find-PSResource with the -IncludeDendencies switch I see different results compared to what Install-PSResource is actually doing. I'm trying to catch what Install-PSResource would do when our pipeline tries to install a module that is already installed. I want to clean up old versions (even if this module is already installed) to keep our environment tidy but this requires me to know what Install-PSResource would install. I used to invoke Install-PSResource with the -Reinstall -PassThru switches but the Az modules installs quite a bit of prerequisites so it introduces more chance of pipeline failures (proxy timeouts etc) that I'd rather just check the prerequisites. Therefore I started using Find-PSResource with the -IncludeDependencies switch, expecting it to give me what I need, but it apparently resolves every dependency of every module and therefore duplicates a Az.Accounts 25 times because a lot of the module apparently specify a different version dependency, but should Find-PSResource not give me back what Install-PSResource would result in though?
Expected behavior
Actual behavior
Error details
No response
Environment data
Visuals
No response