This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Create-SelfSignedCertificate | |
{ | |
[cmdletbinding()] | |
Param( | |
[string]$Subject | |
) | |
$subjectDn = new-object -com "X509Enrollment.CX500DistinguishedName" | |
$subjectDn.Encode( "CN=" + $subject, $subjectDn.X500NameFlags.X500NameFlags.XCN_CERT_NAME_STR_NONE) | |
$issuer = $Subject |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param( | |
[Parameter(Mandatory=$true)] | |
[String] $StorageAccountName, | |
[Parameter(Mandatory=$true)] | |
[String] $StorageAccountKey, | |
[Parameter(Mandatory=$true)] | |
[String] $DriveLetter, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) { | |
X509Certificate2 apiCert = cert as X509Certificate2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$UninstallKey="SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall" | |
$reg = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey("$UninstallKey") | |
$products = @() | |
foreach ($name in $reg.GetSubKeyNames()) { | |
$product = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey("$UninstallKey\$name") | |
$products += $product.GetValue("DisplayName") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace CreateCert | |
{ | |
using System; | |
using System.Collections.Generic; | |
using System.Security.Cryptography.X509Certificates; | |
using System.Threading.Tasks; | |
class Certificate | |
{ | |
public static async Task<X509Certificate2> Create(string subject, string friendlyName, IEnumerable<string> alternativeNames) |