A functional way to utilize System.Net.WebClient with X509 Smart Card certificates in PSv2.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Invoke-CertWebClient.ps1
README.md

README.md

Invoke-CertWebClient

SYNOPSIS

A functional way to utilize System.Net.WebClient with X509 Smart Card certificates in PSv2.

DESCRIPTION

Invoke-CertWebClient defines a WebClient extension class that creates a request using provided certificates. It also takes arguments to assist making certificate authenticated web requests in a corporate environment such as utilizing the default system proxy and passing custom HTTP headers.

NOTES

File Name : Invoke-CertWebClient.ps1

Prerequisite : PowerShell V2 over Vista and up.

Progress

Platform x509 Requests Custom Headers Proxy Option Self-Signed SSL Sites
Windows ✔️ ✖️ ✔️ ✔️

Usage

# Simple case, just specify the URL and Output filename
Invoke-CertWebClient -URL [Target URI] -Output [Output Filename]

# Specify HTTP headers for more custom requests
Invoke-CertWebClient -URL [Target URI] -Output [Output Filename] -Headers [Header Dictionary]

# Go through your system's default proxy 
Invoke-CertWebClient -URL [Target URI] -Output [Output Filename] -Proxy
    
# Use the default proxy and blindly trust the foreign host SSL certificate
# (useful for organizations that self-sign, make sure you trust the URL though)
Invoke-CertWebClient -URL [Target URI] -Output [Output Filename] -Proxy -TrustSSL