Skip to content

Instantly share code, notes, and snippets.

View bill-long's full-sized avatar

Bill Long bill-long

  • Microsoft
View GitHub Profile
<#
.SYNOPSIS
Searches the forest for a SID match in objectSid, sidHistory, or msExchMasterAccountSid.
.EXAMPLE
PS C:\> .\Find-Sid.ps1 -Sid "S-1-5-21-408950988-2208783158-1246939005-2158"
Shows all objects matching the specified SID.
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
$prefix = "LAB1"
New-LabDefinition -Name $prefix -DefaultVirtualizationEngine HyperV -ReferenceDiskSizeInGB 100 -VMPath "E:\VMs"
$e15role = Get-LabPostInstallationActivity -CustomRole Exchange2013 -Properties @{ OrganizationName = 'First Organization' }
$e16role = Get-LabPostInstallationActivity -CustomRole Exchange2016 -Properties @{ OrganizationName = 'First Organization' }
$e19role = Get-LabPostInstallationActivity -CustomRole Exchange2019 -Properties @{ OrganizationName = 'First Organization' }
Add-LabMachineDefinition -Name "$($prefix)DC1" -OperatingSystem 'Windows Server 2016 Standard (Desktop Experience)' -MinMemory 2GB -Memory 2GB -MaxMemory 8GB -Processors 4 -DomainName "$($prefix.ToLower()).local" -Roles RootDC
<#
.SYNOPSIS
Finds a mailbox item using a partial EntryId and a message class.
.DESCRIPTION
Corrupted items may have only a few properties and an EntryId that
cannot be opened in MFCMapi. This often surfaces as a reminder that
repeatedly shows up while the appointment for that reminder cannot
be found.
When other approaches fail, you can find the corrupted
# Dump-ScanningProcessOnTimeout
###################################
#
# Change these paths as needed.
#
$dumpFolder = 'C:\data'
$procdumpBinary = 'C:\ProgramData\chocolatey\lib\sysinternals\tools\procdump.exe'
# Attach-OnProcessStart
$ProcessName = "notepad.exe"
$ExceptionFilter = "ScanQueueTimeoutException"
Register-CimIndicationEvent -ClassName Win32_ProcessStartTrace -SourceIdentifier "ProcessStarted"
while ($true) {
$e = @(Get-Event)
if ($e.Count -lt 1) {
param($Database, $MailboxNumberToWatch)
$startingNumber = 0
$currentNumber = 0
$results = .\Count-PhysicalIndexes.ps1 -Database $Database -SaveResults $true
$startingNumber = ($results | Where-Object { $_.MailboxNumber -eq $MailboxNumberToWatch }).IndexCount
$currentNumber = $startingNumber
param($Database, $SaveResults)
. $exscripts\ManagedStoreDiagnosticFunctions.ps1
if ($null -eq (Get-Command Get-StoreQuery -ErrorAction SilentlyContinue)) {
Write-Error "ManagedStoreDiagnosticFunctions not loaded."
return
}
$results = @()
# Reports the number of indexes per folder for a given mailbox.
# Mailbox can be specified by display name or mailbox number.
[CmdletBinding()]
param (
[Parameter(Position = 0, Mandatory = $true)]
[string]
$Database,
[Parameter()]
# Reports the number of indexes per folder for a given mailbox.
# Mailbox can be specified by display name or mailbox number.
[CmdletBinding()]
param (
[Parameter(Position=0, Mandatory=$true)]
[string]
$Database,
[Parameter()]
Get-MailboxFolderStatistics administrator -FolderScope NonIpmRoot | Select Identity,@{Label="EntryId"; Expression={ -join ([Convert]::FromBase64String($_.FolderId) | % { $_.ToString("X2") }) }}