`Install-PSPreview` module is parsing `-WhatIf` as a path ∴ generating error on `-WhatIf`
Closed this issue · 3 comments
mavaddat commented
PSVersion Table
Name | Value |
---|---|
PSVersion | 5.1.19592.1001 |
PSEdition | Desktop |
PSCompatibleVersions | {1.0, 2.0, 3.0, 4.0...} |
BuildVersion | 10.0.19592.1001 |
CLRVersion | 4.0.30319.42000 |
WSManStackVersion | 3.0 |
PSRemotingProtocolVersion | 2.3 |
SerializationVersion | 1.1.0.1 |
What is the syntax or expression you are using?
Install-PSPreview -WhatIf
What happens?
What if: Performing the operation "Downloading https://github.com/PowerShell/PowerShell/releases/download/v7.1.0-preview.1/PowerShell-7.1.0-preview.1-win-x64.msi" on target "C:\Users\MAVADD~1\AppData\Local\Temp\PowerShell-7.1.0-preview.1-win-x64.msi".
- InstallMsi : Cannot validate argument on parameter 'Path'. The "Test-Path $_" validation script for the argument with value "C:\Users\MAVADD~1\AppData\Local\Temp\whatif-preview.msi" did not return a result of True. Determine why the validation script failed, and then try the command again.
- At C:\Program Files\WindowsPowerShell\Modules\PSReleaseTools\1.6.0\functions\public.ps1:412 char:24
- + InstallMSI @inParams
- + ~~~~~~~~~
- + CategoryInfo : InvalidData: (:) [InstallMsi], ParameterBindingValidationException
- + FullyQualifiedErrorId : ParameterArgumentValidationError,InstallMsi
What do you think should happen?
The output should not error on -WhatIf
specification. When using -WhatIf
, the Install-PSPreview
module seems to be testing the path concatenation of 'whatif
' with 'preview
' to get whatif-preview.msi
, which is not correct. -WhatIf
should not be treated as a path.
jdhitsolutions commented
I need to re-order a few lines of code to better process -Whatif.
jdhitsolutions commented
I published v1.6.1 to the PowerShell Gallery which should fix the issue with this command as well as Install-PowerShell
.
mavaddat commented
The problem is fixed now. Thanks!