Skip to content

Instantly share code, notes, and snippets.

View bradmb's full-sized avatar

Brad Butner bradmb

View GitHub Profile
@bradmb
bradmb / letsencrypt_ssl_bindings.ps
Last active September 24, 2021 09:43
Add Let's Encrypt SSL Certificates To IIS Bindings via Powershell
if (-not (Test-Path -Path "C:\\certs\\win-acme")) {
$url = "https://github.com/win-acme/win-acme/releases/download/v2.1.7/win-acme.v2.1.7.807.x64.pluggable.zip"
$output = "C:\\certs\\win-acme.zip"
Invoke-WebRequest -Uri $url -OutFile $output
Expand-Archive "C:\\certs\\win-acme.zip" -DestinationPath "C:\\certs\\win-acme"
}
cd "C:\\certs\\win-acme"
@bradmb
bradmb / ActiveDirectoryThumbnail.fs
Created February 26, 2015 04:17
Query Active Directory (using sAMAccountName) and Return A Thumbnail Photo
open System.DirectoryServices
/// Gets a user's thumbnail photo from active directory. Returns null if no image found.
let ActiveDirectoryImageFor(samAccount:string):byte[] =
use adSearcher = new DirectorySearcher()
adSearcher.Filter <- "(&(objectClass=user) (sAMAccountName=" + samAccount + "))"
let adResult = adSearcher.FindOne()
if adResult = null
then
@bradmb
bradmb / TimeZoneHelper.cs
Created July 8, 2014 21:22
Time Zone Helper Class
using System;
using System.Collections.Generic;
using System.Linq;
namespace Snippet.Helpers.Timezone
{
/// <summary>
/// Class TimeZoneHelper.
/// </summary>
public static class TimeZoneHelper