This file contains hidden or 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
| <# | |
| MIT License | |
| Copyright (c) Microsoft Corporation. | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is |
This file contains hidden or 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
| # Get-NamedProperties | |
| # | |
| # Example: | |
| # .\Get-NamedProperties.ps1 -Mailbox user1 | ft Prop* | |
| [CmdletBinding()] | |
| param ( | |
| [Parameter()] | |
| [string] | |
| $Mailbox |
This file contains hidden or 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
| [CmdletBinding()] | |
| param ( | |
| [Parameter(Mandatory = $false)] | |
| [int]$MaxRetries = 20, | |
| [Parameter(Mandatory = $false)] | |
| [string]$LogFilePath = "$PSScriptRoot\GetAllPFStatistics.log" | |
| ) | |
| function WriteHostAndLog($message) { |
This file contains hidden or 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
| # Public folder hierarchy and statistics retrieval options | |
| ## Test scenario | |
| # | |
| # PF mailboxes in Exchange Online. | |
| # | |
| # ❯ Get-PublicFolder -Mailbox MB1 -ResidentFolders -Recurse -ResultSize Unlimited | Measure | Select Count | |
| # | |
| # Count | |
| # ----- |
This file contains hidden or 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
| # Example: | |
| # .\Get-MailboxPermissionsDetailed.ps1 -Alias bilong | ft SecurityIdentifier,AceQualifier,AccessMask,Rights | |
| [CmdletBinding()] | |
| param ( | |
| [Parameter()] | |
| [string] | |
| $Alias | |
| ) |
This file contains hidden or 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
| [CmdletBinding(SupportsShouldProcess, ConfirmImpact = "High")] | |
| param ( | |
| [Parameter(Mandatory)] | |
| [string] | |
| $Server, | |
| [Parameter(Mandatory)] | |
| [string] | |
| $Mailbox, |
This file contains hidden or 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
| [CmdletBinding()] | |
| param ( | |
| [Parameter(Mandatory)] | |
| [string] | |
| $Server, | |
| [Parameter(Mandatory)] | |
| [string] | |
| $To, |
This file contains hidden or 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
| function Get-ExchangeServices { | |
| $services = @(Get-Service MSExchange* | Where-Object { $_.StartType -eq "Automatic" }) | |
| $services += Get-Service HostControllerService | |
| $services += Get-Service W3SVC | |
| return $services | |
| } | |
| function Stop-ExchangeServices { | |
| $servicesToStop = Get-ExchangeServices | |
| foreach ($service in $servicesToStop) { |
This file contains hidden or 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
| # Useful for doing MCDB stuff in a lab | |
| $action = New-ScheduledTaskAction -Execute "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -Argument '-Command "Get-PhysicalDisk | Set-PhysicalDisk -MediaType SSD"' | |
| $trigger = New-ScheduledTaskTrigger -AtStartup | |
| $principal = New-ScheduledTaskPrincipal -UserID "NT AUTHORITY\SYSTEM" -LogonType ServiceAccount -RunLevel Highest | |
| Register-ScheduledTask -TaskName "Set Media Type" -Action $action -Trigger $trigger -Principal $principal |
This file contains hidden or 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
| [CmdletBinding()] | |
| param ( | |
| [Parameter()] | |
| [string] | |
| $Mailbox | |
| ) | |
| $mb = Get-Mailbox $Mailbox | |
| . $exscripts\ManagedStoreDiagnosticFunctions.ps1 | |
| $mbTableResult = Get-StoreQuery -Database "$($mb.Database.ToString())" -Query "SELECT MailboxNumber FROM Mailbox WHERE MailboxGuid = '$($mb.ExchangeGuid.ToString())'" |
NewerOlder