diff options
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/fetchDependency.ps1 | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index df03878eb..90de17717 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -8,6 +8,11 @@ function Test-Command($commandName) return [bool](Get-Command -Name $commandName -ErrorAction SilentlyContinue) } +function Test-CommandParameter($commandName, $parameterName) +{ + return (Get-Command $commandName).Parameters.Keys -contains $parameterName +} + function Test-Module($moduleName) { return [bool](Get-Module -ListAvailable -Name $moduleName) @@ -51,7 +56,16 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) $ProxyAuth = !$WC.Proxy.IsBypassed($url) if ($ProxyAuth) { - $ProxyCred = Get-Credential -Message "Enter credentials for Proxy Authentication" + if (Test-CommandParameter -commandName 'Get-Credential' -parameterName 'Message') + { + $ProxyCred = Get-Credential -Message "Enter credentials for Proxy Authentication" + } + else + { + "Enter credentials for Proxy Authentication" + $ProxyCred = Get-Credential + } + $PSDefaultParameterValues.Add("Start-BitsTransfer:ProxyAuthentication","Basic") $PSDefaultParameterValues.Add("Start-BitsTransfer:ProxyCredential",$ProxyCred) $WC.Proxy.Credentials=$ProxyCred |
