Open dzmitry-lahoda opened 5 years ago
Workaround
try {
Expand-Archive -Path $unpacked -DestinationPath "$($FOOBAR_RUNTIME)$($runtimeFolder)/" -Force
}
catch {
tar -xkf $unpacked -C "$($FOOBAR_RUNTIME)$($runtimeFolder)/"
}
I run from cmder
and vscode
consoles on client, not sure if it is relevant
Probably archive should be big enough to repro.
This is actually a limitation of script modules. Script modules inherit variable scope from the global scope, instead of from the calling script scope. The simple workaround is to set the preference variable in global scope:
$global:ProgressPreference = "SilentlyContinue"
More info: https://devblogs.microsoft.com/scripting/weekend-scripter-access-powershell-preference-variables/ https://powershell.org/2014/01/getting-your-script-module-functions-to-inherit-preference-variables-from-the-caller/
Install client of open ssh on windows https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse
install server on windows https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse
Run script which expands archive over SSH:
Actual:
Expected:
Invoke-WebRequest
and $ProgressPreference = 'SilentlyContinue'Machine which fails
Versions:
6.2.1 has same issue.
I expect Expand-Archive to work fine on Windows Server 2019 over Open SSH.