Unable to issue Exchange certificate with Denied By Policy Module 0×80094801.

I was recently renewing an SSL certificate for Exchange services with an internal certificate authority, when issuing the certificate request the following error was received:

Denied By Policy Module 0×80094801, The Request does not contain a certificate template extension or the certificate template request attribute

In order to issue the certificate request I was required to invoke the certreq utility as below agaisnt the certificate request generated, in the below example this is named certrequest.req.

certreq -submit -attrib "CertificateTemplate:WebServer" certrequest.req

Preview recipients that are members of a dynamic distribution list

From the Exchange Management Console you may preview the recipients  returned from the recipient filter applied to the dynamic distribution group.

It is also possible to do this from the Exchange Management Shell by invoking the Get-Recipient cmdlet  agaisnt the recipient filter of the dynamic distribution group as below:

Get-Recipient -RecipientPreviewFilter (Get-DynamicDistributionGroup -Identity "<Dynamic Distrubution Group>").RecipientFilter | Select Name

For Example, to return the names of recipients that match the filter for the dynamic distribution group Sales:

Get-Recipient -RecipientPreviewFilter (Get-DynamicDistributionGroup -Identity "Sales").RecipientFilter | Select Name

Unable to connect to a reconnected mailbox in Exchange

I recently reconnected a number of mailboxes in Microsoft Exchange 2010 Service Pack 3 and following Active Directory replication I was unable to connect to those mailboxes either with the Exchange Management Shell or OWA with the following error messages:

Couldn't connect to the source mailbox 
Your account is disabled

In order to resolve this issue, I had to run the Clean-MailboxDatabase cmdlet agaisnt the mailbox databases to update the status of those mailboxes.

Get-MailboxDatabase | Clean-MailboxDatabase

Retrieve all mailboxes where forwarding address is enabled

I was recently looking at retrieving all mailboxes where the forwarding address was enabled as part of the delivery options and to return the mailbox name, forwarding address and if the option to deliver message to both the forwarding address and mailbox is enabled and export this information to an output file.

I was able to do this by running the below in the Microsoft Exchange Management Shell:, by retrieving all mailboxes where the object ‘ForwardingAddress’ is not equal to null and by selecting the Name, ForwardingAddress and DeliverToMailboxAndForward objects and exporting to a CSV file.

Get-Mailbox | Where-Object {$_.ForwardingAddress -ne $null} | Select Name, ForwardingAddress, DeliverToMailboxAndForward | Export-CSV D:\Output\ForwardingAddresses.csv -NoTypeInformation

Bulk Disable Mailboxes in Exchange 2010

In a recent post, I wrote about performing a bulk export of mailboxes from a collection (https://deangrant.wordpress.com/2013/10/08/bulk-export-of-exchange-mailboxes-from-a-collection/), now that I have performed the bulk export I am looking to disable to the mailboxes using the same collection list.

I will load the collection of mailboxes from a CSV file using the get-content cmdlet to get the content of the file (\\Server\Share\Mailboxes.csv) which contains the alias name of the mailbox.

$Mailboxes = Get-Content "\\Server\Share\Mailboxes.csv"

Now that we have loaded a collection of mailboxes, we will run a script block to disable each mailbox.

ForEach ($Mailbox in $Mailboxes)
Disable-Mailbox -Identity $Mailbox -Confirm:$false

Bulk Export of Exchange Mailboxes from a Collection

I am currently looking at performing a bulk export of mailboxes from Exchange 2010 using the New-MailboxExportRequest cmdlet from a collection within a CSV file.

Firstly, I will want to remove any existing Mailbox Export Requests as I want to provide the status of the bulk export as the final step of the process with no previous history.

Get-MailboxExportRequest | Remove-MailboxExportRequest

Now, I want to generate the collection of mailboxes from reading the content of a file, which contains only the alias of each mailbox. In the below example, I am using the filename \\Server\Share\MailboxAlias.csv.

$Aliases = Get-Content "\\Server\Share\MailboxAlias.csv"

Now I want to request a mailbox export for each mailbox in the collection and export the PST with the Mailbox Name as the filename.  Therefore, the script block will firstly return all the mailbox attributes based on the mailbox alias name in the collection.

Also, by default Microsoft Exchange will auto generate 10 unique names for each mailbox export request. In this instance this is an insufficient amount to complete the bulk export. Therefore, we will specify the mailbox alias as the mailbox export request name.

ForEach ($Alias in $Aliases) 
$Mailbox = Get-Mailbox -Identity $Alias
New-MailboxExportRequest -Name $Mailbox.Alias -Mailbox $Mailbox.Alias -FilePath "\\Server\Share\" + $Mailbox.Name + ".pst"

At the final stage of the process I want to export the mailbox request status, therefore I will need to suspend the collection of this until all the export requests are reported as Completed.

I will perform this step by returning the mailbox export requests until all items are Completed and then export the mailbox request status to a CSV.

Do { 
$Queue = Get-MailboxExportRequest | Where-Object {$_.Status -ne "Completed"} 
Until ($Queue -eq $null)

Get-MailboxExportRequest | Export-Csv "\\Server\Share\GetMailboxExportRequest.csv" -NoTypeInformation

Get Mailbox Database Size and Convert Default Item Size Values

I am looking at extracting mailbox database sizes for a number of users which match a certain filter for the primary SMTP address in Microsoft Exchange 2010 and export this to a CSV file.

Firstly, I need to return all mailboxes for users matching my filter, in this example it is when the primary SMTP address can be like two domains.

Get-Mailbox | Where-Object {$_.PrimarySMTPAddress -like "*@domain1.com" -or $_.PrimarySMTPAddress -like "@domain2.com"}

Now, that I have all the mailboxes that match my filter I will pipe the output to the Get-MailboxStatistics cmdlet to return the Display Name and Total Item Size.

Get-MailboxStatistics | Select DisplayName, TotalItemSize

This will return the information I require, but the Total Item Size will be displayed in both MB and bytes.

DisplayName TotalItemSize
----------- -------------
User1       1.992 MB (2,088,411 bytes)

I am required to return the Total Item Size output in MB only, therefore I will be required to create an expression for the Total Item Size and convert the original value into MB.

@{expression={$_.TotalItemSize.Value.ToMB()}; label="TotalItemSizeMB"}

So lets put the full script together and export this to a CSV file.

Get-Mailbox | Where-Object {$_.PrimarySMTPAddress -like "*@domain1.com" -or $_.PrimarySMTPAddress -like "*@domain2.com"} | Get-MailboxDatabaseStatistics | Select DisplayName, @{expression={$_.TotalItemSize.ValueToMB(); label="TotalItemSizeMB"}