Skip to content

Instantly share code, notes, and snippets.

Bill Long bill-long

Block or report user

Report or block bill-long

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View GetNotificationWaits.ps1
param($IpAddress, $File)
function OutputItems($start, $end, $items) {
for ($x = $start; $x -le $end; $x++) {
$items[$x]
}
}
Write-Progress -Activity "Reading file"
$sw = [System.Diagnostics.Stopwatch]::StartNew()
View keybase.md

Keybase proof

I hereby claim:

  • I am bill-long on github.
  • I am bill_long (https://keybase.io/bill_long) on keybase.
  • I have a public key ASB1qPGk7xPfX491VE-Q7v0yhRCpAIgKXZNOEVA8EoCZTAo

To claim this, I am signing this object:

View SetupServer.ps1
<#
Examples
Create a DC:
iex ((New-Object System.Net.WebClient).DownloadString('https://gist.github.com/bill-long/04f2e34143553ea3ee35e3322170559b/raw'))
SetupServer -ComputerName LAB7DC1 -IpAddress "10.7.0.1" -PrefixLength 8 -Gateway "10.0.0.1" -DnsServer "10.0.0.1" -DomainName "bilonglab7.com" -MakeForest
Create an Exchange server:
View Dump-InternetMessageIds.ps1
#########################################
# Dump-InternetMessageIds.ps1
#
param([string]$HostName, [string]$UserName, [string]$Mailbox, [string]$InputFile)
#########################################
# Update the path below to match the actual path to the EWS managed API DLL.
#
@bill-long
bill-long / PublicFolderCalendarBind.ps1
Created Sep 6, 2018
Reproduce an error binding to a calendar public folder
View PublicFolderCalendarBind.ps1
#####
# Change as needed
$folderPath = "\Bill\Some Calendar"
$user = "bill@contoso.com"
#
#####
Import-Module -Name "C:\Program Files\Microsoft\Exchange\Web Services\2.2\Microsoft.Exchange.WebServices.dll"
$password = $host.ui.PromptForCredential("Credentials", "Please enter your password to authenticate to EWS.", $user, "").GetNetworkCredential().Password
$exchService = new-object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2016)
View Compare-GroupMembership.ps1
# Compare-GroupMembership.ps1
#
# Compares group membership across all GCs to verify replication.
param($Alias)
$forest = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest()
$allGCs = $forest.FindAllGlobalCatalogs()
$dictionary = New-Object 'System.Collections.Generic.Dictionary[string, System.Collections.Generic.HashSet[string]]'
foreach ($gc in $allGCs) {
@bill-long
bill-long / RecreatePFs.ps1
Created Jan 12, 2018
When performing New-MailboxRestoreRequest against a PF mailbox, public folders that don't exist in the hierarchy do not get created automatically. The report shows the missing folders. This script uses that report to recreate the hierarchy, so that the restore succeeds on the second attempt.
View RecreatePFs.ps1
# Make sure the report is in the $report variable. Then just copy and paste this into Exchange Management Shell.
$report.Report.MailboxVerification | WHERE { $_.FolderIsMissing } | % {
$path = $_.FolderSourcePath
if (!($path.StartsWith("/IPM_SUBTREE"))) {
continue
}
$path = $path.Substring(12).Replace("/", "\")
$lastSlashIndex = $path.LastIndexOf("\")
@bill-long
bill-long / GenerateIotaSeed.ps1
Last active Dec 8, 2017
Generate IOTA seed in Powershell using RNGCryptoServiceProvider
View GenerateIotaSeed.ps1
# PowerShell script to generate IOTA seed.
# See https://matthewwinstonjohnson.gitbooks.io/iota-guide-and-faq/getting-started/dl-wallet/what-is-my-seed.html
# for seed requirements.
# See https://msdn.microsoft.com/en-us/library/system.security.cryptography.rngcryptoserviceprovider(v=vs.110).aspx
# for the reasoning behind IsFairRoll.
function IsFairRoll($roll, $sides)
{
$fullSetsOfValues = [Byte]::MaxValue / $sides
return $roll -lt $sides * $fullSetsOfValues
View Dump-SearchAndStopIDNAOnEvent.ps1
# Dump-SearchAndStopIDNAOnEvent
###################################
#
# Change these paths as needed.
#
$dumpFolder = 'C:\data'
$procdumpBinary = 'C:\ProgramData\chocolatey\lib\sysinternals\tools\procdump.exe'
$tttracerBinary = 'C:\iDNA\tttracer.exe'
View Test-EWSEndpoints.ps1
# Syntax:
# Test-EWSEndpoints someuser@contoso.com
param($emailAddress)
Import-Module -Name "C:\Program Files\Microsoft\Exchange\Web Services\2.2\Microsoft.Exchange.WebServices.dll"
$urls = New-Object 'System.Collections.Generic.List[string]'
# Update these URLs to reflect the URLs you want to test
You can’t perform that action at this time.