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
# Check-HierarchySync.ps1 | |
$allPFs = New-Object 'System.Collections.Generic.List[string]' | |
$PFsPerMbx = New-Object 'System.Collections.Generic.Dictionary[string, System.Collections.Generic.List[string]]' | |
$pfMailboxes = Get-Mailbox -PublicFolder | |
foreach ($pfMailbox in $pfMailboxes) | |
{ | |
"Getting public folders from mailbox: " + $pfMailbox | |
$pfs = Get-PublicFolder -Recurse -Mailbox $pfMailbox.Identity | % { $_.Identity.ToString() } |
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
# Find-MailboxExportTombstones | |
$file = 'C:\someldiffile.txt' | |
Add-Type @" | |
using System; | |
public class Tombstone { | |
public DateTime WhenCreated; | |
public DateTime WhenChanged; | |
public Guid ObjectGuid; |
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
$localComputerName = [Environment]::MachineName | |
# Monitor counter for threshold | |
function WaitForCounter($counter, $value, $duration) | |
{ | |
"Started watching " + $counter + " to reach " + $value + " for " + $duration | |
$timeCounterReached = [DateTime]::MaxValue | |
Get-Counter -Counter $counter -Continuous | | |
% { |
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
$nmcapDataFolder = 'C:\CollectedData' | |
$wprDataFolder = 'C:\CollectedData' | |
$nicToCapture = '*' # Can be a number or * | |
$numberOfCapFilesToKeep = 5 | |
$localComputerName = [Environment]::MachineName | |
# Monitor counter for threshold | |
function WaitForCounter($counter, $value, $duration) | |
{ |
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
$nmcapDataFolder = 'C:\CollectedData' | |
$wprDataFolder = 'C:\CollectedData' | |
$wprBinary = 'C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\wpr.exe' | |
$procdumpBinary = 'C:\tools\sysinternals\procdump.exe' | |
$nicToCapture = '*' # Can be a number or * | |
$numberOfCapFilesToKeep = 5 | |
$localComputerName = [Environment]::MachineName | |
function Log($logString) |
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
$lastHighestUSN = 0 | |
$rootDSE = [ADSI]("LDAP://RootDSE") | |
$lastHighestUSN = $rootDSE.highestCommittedUSN | |
"Starting highest USN: " + $lastHighestUSN | |
$configNC = [ADSI]("LDAP://" + $rootDSE.configurationNamingContext) | |
while ($true) | |
{ | |
$rootDSE = [ADSI]("LDAP://RootDSE") | |
$highestUSN = $rootDSE.highestCommittedUSN | |
if ($lastHighestUSN -lt 1) { $lastHighestUSN = $highestUSN } |
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
$perfLogsFolder = "C:\Perflogs" | |
$numberOfDirectoriesToKeep = 3 | |
# Check to see if we need to clean up old nmcap files | |
$directories = new-object 'System.Collections.Generic.List[string]' | |
$directories.AddRange([System.IO.Directory]::GetDirectories($perfLogsFolder)) | |
while ($directories.Count -gt $numberOfDirectoriesToKeep) | |
{ | |
$oldestFileTime = [DateTime]::MaxValue | |
$oldestFileName = "" |
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
$perfLogsFolder = "C:\Perflogs" | |
$numberOfDaysToKeep = 3 | |
$dateThreshold = [DateTime]::Now.AddDays(0 - $numberOfDaysToKeep) | |
# Check to see if we need to clean up old nmcap files | |
$files = new-object 'System.Collections.Generic.List[string]' | |
$files.AddRange([System.IO.Directory]::GetFiles($perfLogsFolder)) | |
$filesToDelete = new-object 'System.Collections.Generic.List[string]' |
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
# ScanADContainersForSid.ps1 | |
# | |
# Traverses the Active Directory hierarchy looking | |
# for a SID in the ACL on any container. | |
# | |
# Examples: | |
# | |
# .\ScanADContainersForSid DC1 S-1-5-32-544 | |
# | |
# .\ScanADContainersForSid DC1 S-1-5-32-544 -ConfigContext $true -Verbose $true |
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
# Fix-MailEnabledFromUnlinkedOutput.ps1 | |
# | |
# The purpose of this script is to read the output of | |
# Find-UnlinkedPFProxies.ps1 and try to link those proxies | |
# back to their folders. | |
# | |
# This script must be run from Exchange Management Shell. | |
# File is required, DC is optional | |
# Example syntax: |