I'm trying to reach our Artifactory repository using the following PowerShell command:
$dest = 'https://artifactory.****.de/artifactory/*********/'
Invoke-WebRequest -Uri $dest -Credential (Get-Credential)
While this works flawlessly in PowerShell 7.2.4, Windows PowerShell 5.1 throws an exception after I enter my credentials into the Enter Your Credential pop-up dialog:
Invoke-WebRequest : { "errors" : [ { "status" : 401, "message" : "Bad credentials" } ] }
In line:2 column:1
+ Invoke-WebRequest -Uri $dest -Credential (Get-Credential)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
I suspect there may be an issue with my password, because it contains an umlaut character.
How can I make this work in Windows PowerShell 5.1?