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 Dump-RuleStream.ps1
#########################################
# Dump-RulesStream.ps1
#
# Dumps PR_RW_RULES_STREAM from IPM.RuleOrganizer
#
# Example:
#
# .\Export-RulesStream.ps1 -HostName e16srv1.contoso.com -UserName admin@contoso.com -Mailbox someuser@contoso.com
#
# Instead of specifying -Mailbox, you can also pass it a file that contains a list of SMTP addresses:
View Delete-RulesAfterDate.ps1
#########################################
# Delete-RulesAfterDate.ps1
#
# Deletes all inbox rules that were created after a certain date.
# The date must be configured below. Also, the script won't actually
# delete anything until you flip $makChanges to $true.
#
# Example:
#
# .\Delete-RulesAfterDate.ps1 -HostName e16srv1.contoso.com -UserName admin@contoso.com -Mailbox someuser@contoso.com
View Check-UnresolvedSids.ps1
# Check-UnresolvedSIDs.ps1
#
# This script will remove all unresolved SIDs from public folder permissions.
# This will take quite some time to run against a large hierarchy.
param([string]$Server, [bool]$Remove)
if ([System.String]::IsNullOrEmpty($Server))
{
"You must specify a server."
View AuthzInitializeContextFromSid.ps1
param([string]$sidString)
$authzInitializeResourceManagerSig = @'
[DllImport("authz.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool AuthzInitializeResourceManager(int flags, IntPtr pfnAccessCheck, IntPtr pfnComputeDynamicGroups,
IntPtr pfnFreeDynamicGroups, string szResourceManagerName, out IntPtr phAuthzResourceManager);
'@
$authzInitializeContextFromSidSig = @'
[DllImport("authz.dll", EntryPoint = "AuthzInitializeContextFromSid", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
View Reset-MailboxSD.ps1
# Reset-MailboxSD
#
# This version is intended for Exchange 2013 and 2016, where we have to
# update the value in AD.
#
# Usage:
#
# To do one user:
#
# .\Reset-MailboxSD.ps1 "CN=SomeUser,OU=Wherever,DC=contoso,DC=com"
View WprLoop.ps1
$wprBinary = 'C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\wpr.exe'
$wprDataFolder = 'D:\wprdata'
$numberOfFilesToKeep = 5
$localComputerName = [Environment]::MachineName
while ($true)
{
"Starting..."
& $wprBinary -start CPU
"WPR started at " + (Get-Date).ToString()
View Get-ReplicationReport.ps1
#requires -version 2
<#
.SYNOPSIS
PF replication report script with primary goals of performance and terse output.
.DESCRIPTION
This script will run Get-PublicFolderStatistics against all specified servers
simultaneously, and will begin processing the results as soon as any of those
View Stop-TTTraceOnEvent.ps1
# Events to watch for
$event1 = New-Object -TypeName PSObject -Prop (@{'ID'='2080'; 'Source'='MSExchange ADAccess'; 'Message'="In-site:`r`nSX"})
$interestingEvents = @($event1)
# Monitor event log for specific event ID
function WaitForEvent($logName, $eventsToWatchFor, $serverName)
{
"Started watching " + $logName + " log on server " + $serverName + " for the following events: "
$eventsToWatchFor
View CollectDumpsOnPerfTrigger.ps1
$dataFolder = 'C:\CollectedData'
$procdumpBinary = 'C:\tools\sysinternals\procdump.exe'
#####
$localComputerName = [Environment]::MachineName
function Log($logString)
{
(Get-Date).ToString("o") + " " + $logString
View MailboxMapSizeCheck.ps1
# MailboxMapSizeCheck
param($folderSizeFile, $mailboxMapFile)
$folderSizes = Import-Csv $folderSizeFile
$mailboxMap = Import-Csv $mailboxMapFile
$mailboxSizes = New-Object 'System.Collections.Generic.Dictionary[string, long]'
foreach ($folder in $folderSizes)
{
You can’t perform that action at this time.