This script sets the mailbox ExternalOofOptions to 'External' for members of a given security group.
ExternalOofOptions for users that are NOT a member of the security group will be set to 'InternalOnly'. If required the script will set the ExternalAudience to None and will delete an existing OOF message.
Controlling the ExternalOofOptions and ExternalAudience settings has been implemented to follow dedicated company compliance rules.
This is the second of two scripts for the complete solution. Find the first script here.
# EXAMPLE # Run script with default settings .\Set-ExternalOOF.ps1
This script fetches emails from a given monitoring mailbox by searching email messages for a given subject string. In this case email messages sent by the ENow Management Suite (http://enowsoftware.com/). Status messages are parsed to extract Disk Performance alert data for further processing in Power BI.
The mailbox is queried using Exchange Web Services (EWS). The EWS endpoint is identified by AutoDiscover.
The script exports the following columns for further processing:
You can easily adjust the script to fit your requirements. Search for other message subjects and parse for other content in the message body.
Code Samples
# Run script using default parameters .\Get-EmailContent.ps1
"COMPUTER";"DATE";"TIME";"IO";"THRESHOLD";"VALUE" "EXLABP08";"19.05.2017";"11:15:38";"READ";"Critical";"109,90" "EXLABP08";"19.05.2017";"11:15:38";"WRITE";"Warning";"23,61" "EXLABP08";"19.05.2017";"11:15:38";"READ";"Critical";"80,13" "EXLABP08";"19.05.2017";"11:15:38";"WRITE";"Warning";"21,58" "EXLABP08";"19.05.2017";"11:15:38";"READ";"Warning";"33,01" "EXLABP08";"19.05.2017";"11:15:38";"READ";"Critical";"53,04" "EXLABP08";"19.05.2017";"11:15:38";"READ";"Warning";"24,24" "EXLABP08";"19.05.2017";"11:15:38";"READ";"Warning";"40,01"
This example shows that P04 and P08 have exceeded the critical and warning state disk performance thresholds more often than the other servers.
The next example shows the same date in a different report.
When you delete a public folder using a legacy Outlook client, you can easily restore the deleted folder and it's content using the Recover Deleted Items function.
Due to a fancy trick implemented in Outlook 2013 and Outlook 2016 the recovered folder will not be recovered using it's full name.
This phenomenon has been verified with Exchange On-Premises and Exchange Online on the server side and Outlook 2013/2016 and Outlook 365 ProPlus.
The following example uses public folders in Exchange Online and Outlook 365 ProPlus.
In this example I will delete and recover a public folder named My Public Folder.
After deletion of My Public Folder and it's content, I need to select the original parent folder and click the Recover Deleted Items button in the button bar.
The Recover Deleted Items dialogue opens and we select the deleted item for recovery. The dialogue displays the original name of the deleted folder.
After recovering the deleted folder the folder is recovered with the first character only.
That's an annoying result in regards to customer self-care when users restore deleted items on their own behalf.
But wait, there is a solution available.
The solution requires today's primary administrative tool available: PowerShell.
Get an overview of public folders currently located in the public folder dumpster
Get-PublicFolder –Identity “\NON_IPM_SUBTREE” –Recurse Name Parent Path ---- ----------- NON_IPM_SUBTREE [...] My Public Folder \NON_IPM_SUBTREE\DUMPSTER_ROOT\DUMPSTER_EXTEND\RESERVED_1\RESERVED_1\65722859-3... Sub Folder 1 \NON_IPM_SUBTREE\DUMPSTER_ROOT\DUMPSTER_EXTEND\RESERVED_1\RESERVED_1\65722859-3... Sub Folder 2 \NON_IPM_SUBTREE\DUMPSTER_ROOT\DUMPSTER_EXTEND\RESERVED_1\RESERVED_1\65722859-3... [...]
Export the list of public folders currently located in the public folder dumpster and find the identity of the deleted public folder you want to recover
Get-PublicFolder –Identity “\NON_IPM_SUBTREE” –Recurse | fl | Out-File D:\TMP\publicfolderdumpster.txt
publicfolderdumpster.txt excerpt:
RunspaceId : 6ce9588e-829b-4592-aedc-85f9a2e2c963 Identity : \NON_IPM_SUBTREE\DUMPSTER_ROOT\DUMPSTER_EXTEND\RESERVED_1\RESERVED_1\65722859-366a-4e0 9-81fe-ea576ec7a6f7\My Public Folder Name : My Public Folder MailEnabled : False MailRecipientGuid : ParentPath : \NON_IPM_SUBTREE\DUMPSTER_ROOT\DUMPSTER_EXTEND\RESERVED_1\RESERVED_1\65722859-366a-4e0 9-81fe-ea576ec7a6f7
Recover the deleted public folder to the correct parent target folder
Set-PublicFolder –Identity "\NON_IPM_SUBTREE\DUMPSTER_ROOT\DUMPSTER_EXTEND\RESERVED_1\RESERVED_1\65722859-366a-4e09-81fe-ea576ec7a6f7\My Public Folder" –Path “\TestFolders” –Verbose
As a result the public folder is recovered with it's original name.
There are some other things to consider when recovering deleted modern public folders.
Public folders originally located in the hierarchy root are always recovered to the public folder mailbox holding the primary hierarchy.
Public folders originally located in the hierarchy root will replace the permissions of child public folders when restored.
More on these default restore behaviours can be read here.
Nevertheless, enjoy modern public folders.
The PowerShell script to purge Exchange Server and IIS log files has been updated to version 2.0.
Release 2.0 allows for copying of files that will be deleted to be copied to a central file repository. The script will create a folder per server and the full log file folder structure will be preserved.
The next release will contain an option to compress the copied log files.
Added code:
function Copy-LogFiles { [CmdletBinding()] param( [string]$SourceServer, [string]$SourcePath, $FilesToMove ) if($SourceServer -ne '') { # path per SERVER for zipped archives $ServerRepositoryPath = Join-Path -Path $RepositoryRootPath -ChildPath $SourceServer # subfolder used as target for copying source folders and files $ServerRepositoryLogsPath = Join-Path -Path $ServerRepositoryPath -ChildPath $LogSubfolderName $ServerRepositoryPath = Join-Path -Path $RepositoryRootPath -ChildPath $SourceServer if(!(Test-Path -Path $ServerRepositoryPath)) { # Create new target directory for server, if does not exist $null = New-Item -Path $ServerRepositoryPath -ItemType Directory -Force -Confirm:$false } foreach ($File in $FilesToMove) { # target directory $targetDir = $File.DirectoryName.Replace($TargetServerFolder, $ServerRepositoryLogsPath) # target file path $targetFile = $File.FullName.Replace($TargetServerFolder, $ServerRepositoryLogsPath) # create target directory, if not exists if(!(Test-Path -Path $targetDir)) {$null = mkdir -Path $targetDir} # copy file to target $null = Copy-Item -Path $File.FullName -Destination $targetFile -Recurse -Force -Confirm:$false -ErrorAction SilentlyContinue }-Force if($ZipArchive) { # zip copied log files # <# NOT FULLY TESTED YET $Archive = Join-Path -Path $ServerRepositoryPath -ChildPath $ArchiveFileName $logger.Write(('Zip copied files to {0}' -f $ArchiveFileName)) if(Test-Path -Path $Archive) {Remove-Item $Archive -Force -Confirm:$false} Add-Type -AssemblyName 'System.IO.Compression.FileSystem' [IO.Compression.ZipFile]::CreateFromDirectory($ServerRepositoryLogsPath,$Archive) #> } } }
As an Exchange administrator you normally perform tasks by executing PowerShell scripts. Some of these scripts are executed automatically, some are run manually as these scripts require more attention.
Think about a completely different approach. Have you ever thought about administrating Exchange Server or your Exchange Online instance using your voice?
Thanks to Alexa skills we can do something like
"Alexa, ask Exchange Assistant to create a new mailbox for John Doe" "Alexa, is the CEO's mailbox in good shape?"
"Alexa, ask Exchange Assistant to create a new mailbox for John Doe"
"Alexa, is the CEO's mailbox in good shape?"
Or run something more complicated
"Alexa, start Exchange to setup 5 new Exchange servers, please"
Sounds like magic, right?
As a solution we use the following technologies:
The Azure Hybrid Runbook Worker enables you to execute PowerShell runbooks in your local infrastructure to manage local ressources.
The solution consists of a Visual Studio Solution acting as an Alexa skill endpoint. The configured intents connect to your Azure Automation webhooks and trigger the execution of preconfigured PowerShell automation runbooks.
These runbooks can either run againt Azure resources or against your local infrastructure. Automation of your local infrastructure requires the setup of the Azure Hybrid Runbook Worker components.
The following diagram illustrates the functionality.
The solution utilizes the Azure4Alexa and AlexaSkillsSet.NET projects available on Github. Currently the approach requires some manual steps and Visual Studio knowledge, as you want to deploy your own Alexa custom application. This is primarily driven due to security demands. The Hybrid Runbook Worker can access your local infrastructure. So you went to be in charge of the credentials used to access your infrastructure.
Start enjoying how your administrator's can orchestrate your Exchange Server environment.
Enjoy your wonderful life with Exchange :-)