Skip to content

Instantly share code, notes, and snippets.

@jimmypc92
jimmypc92 / APIGet.ps1
Last active January 23, 2023 19:01
PowerShell IIS Administration API demo
# Add type to handle the API certificate
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class ITrustACertificatePolicy : ICertificatePolicy {
public ITrustACertificatePolicy() {}
public bool CheckValidationResult(
ServicePoint sPoint, X509Certificate cert,
WebRequest wRequest, int certProb) {
@jimmypc92
jimmypc92 / Program.cs
Last active October 20, 2017 18:36
HttpClient IIS Administration API demo
namespace ConsoleAPIClient
{
using System;
using System.Net;
using System.Net.Http;
using System.Security.Cryptography.X509Certificates;
class Program
{
private const string SITES_ENDPOINT = "https://jimmyca-srv2.cloudapp.net:55539/api/webserver/websites";