Disclaimer - ive no idea what X-SDS-AUTH-TOKEN is - but you appear to be performing a simple GET request with BASIC auth so...
Step 1 - understand the command you want to replicate - consult the man page for Curl and read about each of the arguments your passing to curl -L
-v
-k
and -u username:password
. In summary:
-L
- this instructs Curl to follow redirects
-v
- enable Curl's verbose output
-k
- allows "insecure" SSL connections (self signed / expired / untrusted certificates)
-u user:pwd
- pass username "user" and password "pwd" to the webpage
Step 2 - Powershell gives you a few options, but for a simple GET request take a look at Invoke-WebRequest
.
Comparing the default behavior of Invoke-WebRequest
to curl
you will find:
Invoke-WebRequest
follows redirects by default
- PowerShell provides a
-Verbose
switch with many commands, but this is not required
Invoke-WebRequest
provides -SkipCertificateCheck
in newer versions of powershell, but it can be achieved via .Net for older versions. This is a security risk - make sure you understand the implications of bypassing certificate checks.
- I think curl will do BASIC auth by default.
Invoke-WebRequest
has an -Authentication
switch (but it requires a powershell credential object) - BUT you might find it easier to create an Authorization
header yourself using the -Headers
switch.
I'm not going to give you a full solution, but this should point you in the general direction. Good luck!