This file contains 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
## This code released under the MIT open source license. | |
## See here for details: https://opensource.org/licenses/MIT | |
## This code is provided with NO SUPPORT and NO WARRANTY and NO GUARANTEE. Use at your own risk. | |
[string] $ApiKey = "" | |
[string] $ApiSecret = "" | |
## only populate $indirectAccountNumber if you want a list from one specific account, otherwise leave blank. | |
[string] $indirectAccountNumber = "" | |
[string] $path = "AllMailboxes.csv" |
This file contains 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
<?xml version="1.0" encoding="utf-8" ?> | |
<configuration> | |
<configSections> | |
<section name="quartz" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" /> | |
</configSections> | |
<quartz> | |
<add key="quartz.scheduler.instanceName" value="test1" /> | |
<add key="quartz.scheduler.instanceId" value="AUTO" /> | |
<add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" /> | |
<add key="quartz.threadPool.threadCount" value="10" /> |
This file contains 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
## the cert dns doesn't really matter since it's self-signed. | |
$certName = "myappname.local" | |
$cert = New-SelfSignedCertificate -CertStoreLocation Cert:\LocalMachine\My -DnsName $certName | |
Write-Host "Created self signed cert: $($cert.Thumbprint) " | |
$guid = [guid]::NewGuid() | |
$ip = "0.0.0.0:443" | |
"http add sslcert ipport=$ip certhash=$($cert.Thumbprint) appid={$guid} " | netsh | |
#### netsh http delete sslcert ipport=$ip |
This file contains 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
/// This code is copywright 2017 by Steven Swenson and released under the MIT open source license. | |
/// https://opensource.org/licenses/MIT | |
using System; | |
using System.IO; | |
using log4net.Core; | |
using log4net.Layout.Pattern; | |
using Newtonsoft.Json; | |
namespace TestLog4Net |
This file contains 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 Enable-DynamicIpThrottling($webSiteName, [bool] $enabled, [int]$maxRequests, [int]$intervalMilliseconds, [bool] $loggingOnly = $false) { | |
##https://docs.microsoft.com/en-us/iis/configuration/system.webserver/security/dynamicipsecurity/ | |
Add-Type -Path "$env:SystemRoot\System32\inetsrv\Microsoft.Web.Administration.dll" | |
$manager = New-Object Microsoft.Web.Administration.ServerManager | |
$config = $manager.GetApplicationHostConfiguration(); | |
$cpSecConfig = $config.GetSection("system.webServer/security/dynamicIpSecurity", $websiteName) | |
$cpSecConfig.SetAttributeValue("enableLoggingOnlyMode", $loggingOnly) | |
$requestRate = $cpSecConfig.ChildElements["denyByRequestRate"] |
This file contains 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 Enable-IpSecurityProxyMode($websiteName) { | |
Add-Type -Path "$env:SystemRoot\System32\inetsrv\Microsoft.Web.Administration.dll" | |
$manager = New-Object Microsoft.Web.Administration.ServerManager | |
$config = $manager.GetApplicationHostConfiguration(); | |
$cpSecConfig = $config.GetSection("system.webServer/security/ipSecurity", $websiteName) | |
$cpSecConfig.SetAttributeValue("enableProxyMode",$true) | |
$manager.CommitChanges(); | |
$manager.Dispose() |
This file contains 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 Add-IpToIisBlacklist($websiteName, $ip, $subnetMask = $null) { | |
Add-Type -Path "$env:SystemRoot\System32\inetsrv\Microsoft.Web.Administration.dll" | |
$manager = New-Object Microsoft.Web.Administration.ServerManager | |
$config = $manager.GetApplicationHostConfiguration(); | |
$cpSecConfig = $config.GetSection("system.webServer/security/ipSecurity", $websiteName) | |
$cpSecCollection = $cpSecConfig.GetCollection() | |
$newAdd = $cpSecCollection.CreateElement("add") | |
$newAdd["ipAddress"] = $ip | |
if ($subnetMask) { |
This file contains 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 Get-XapiSignature($userAgent, $apiKey, $apiSecret) { | |
$dateTime = [DateTime]::UtcNow.ToString("yyyyMMddHHmmss"); | |
$dataToSign = [String]::Format("{0}{1}{2}{3}", $apikey, $userAgent, $dateTime, $apiSecret); | |
$sha1 = [System.Security.Cryptography.SHA1]::Create(); | |
$signedBytes = $sha1.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($dataToSign)); | |
$signature = [System.Convert]::ToBase64String($signedBytes); | |
$sha1.Dispose() | |
[String]::Format("{0}:{1}:{2}", $apikey, $dateTime, $signature); | |
} |
This file contains 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
if (-not $hostMap) { | |
$whoisHostMapUrl = "https://raw.githubusercontent.com/weppos/whois/master/data/tld.json" | |
$raw = Invoke-RestMethod $whoisHostMapUrl | |
$hostMap = @{} | |
$raw.psobject.Properties | ?{ $_.Value.host } | Foreach { $hostMap[$_.Name] = $_.Value.host } | |
} | |
## $hostMap["com"] will return whois.verisign-grs.com |
This file contains 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
// I've moved this to a full repo: | |
// https://github.com/ctigeek/SqlUnitTestHelper |