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
param( | |
[Parameter(Position=0, Mandatory=$true)] | |
[string] $Pattern, | |
[Parameter(Position=1, Mandatory=$false)] | |
[string] $File, | |
[Parameter(Mandatory=$false)] | |
[string] $Directory, | |
[Parameter(Mandatory=$false)] | |
[string] $FileFilter, | |
[Parameter(Mandatory=$false)] |
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
param($file) | |
$reader = new-object System.IO.StreamReader($file) | |
$errorsDictionary = new-object 'System.Collections.Generic.Dictionary[string,int]' | |
$nextLineIsError = $false | |
while ($null -ne ($buffer = $reader.ReadLine())) | |
{ | |
if ($nextLineIsError) | |
{ | |
$nextLineIsError = $false |
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
######################################### | |
# GenericDoAllMailboxFoldersScript.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. | |
# |
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
param($folder) | |
$ExperimentalIOBinary = 'C:\Users\administrator\Desktop\Microsoft.Experimental.IO.dll' | |
[System.Reflection.Assembly]::LoadFile($ExperimentalIOBinary) | |
function DeleteAllFilesRecursive($path) | |
{ | |
"Getting folders in folder: " + $path | |
$subfolders = [Microsoft.Experimental.IO.LongPathDirectory]::EnumerateDirectories($path) | |
foreach ($subfolder in $subfolders) |
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
param($folder) | |
$ExperimentalIOBinary = 'C:\Users\administrator\Desktop\Microsoft.Experimental.IO.dll' | |
[System.Reflection.Assembly]::LoadFile($ExperimentalIOBinary) | |
function DeleteAllFilesRecursive($path) | |
{ | |
"Getting folders in folder: " + $path | |
$subfolders = [Microsoft.Experimental.IO.LongPathDirectory]::EnumerateDirectories($path) | |
foreach ($subfolder in $subfolders) |
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
# Resolve-SIDs.ps1 | |
# | |
# Resolve a bunch of SIDs from a text file, in a loop. | |
param($file) | |
$sids = New-Object 'System.Collections.Generic.List[string]' | |
$reader = New-Object System.IO.StreamReader($file) | |
while ($null -ne ($buffer = $reader.ReadLine())) | |
{ |
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
$dataFolder = 'C:\CollectedData' | |
$nicToCapture = '*' # Can be a number or * | |
$collectNmcap = $true | |
$numberOfCapFilesToKeep = 5 | |
$collectProcdump = $false | |
$procdumpProcessOrPID = '1234' | |
$collectEventLogs = $true | |
$collectLdapClientTrace = $false |
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
foreach($level in "Machine","User") { | |
[Environment]::GetEnvironmentVariables($level).GetEnumerator() | % { | |
# For Path variables, append the new values, if they're not already in there | |
if($_.Name -match 'Path$') { | |
$_.Value = ($((Get-Content "Env:$($_.Name)") + ";$($_.Value)") -split ';' | Select -unique) -join ';' | |
} | |
$_ | |
} | Set-Content -Path { "Env:$($_.Name)" } | |
} |
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
################################################################################# | |
# RemoveProperty.ps1 | |
# | |
# Removes property 0x3FC9 from public folders. | |
param([string]$FolderPath, [string]$HostName, [string]$UserName, [boolean]$Recurse, [boolean]$Fix) | |
################################################################################# | |
# Update the path below to match the actual path to the EWS managed API DLL. | |
# |
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() } |