de-DEen-GB
 
rss

Just can't get enough of IT

This blog is about mostly anything in IT. But the primary focuses are Microsoft Technologies like Exchange, Office 365, Azure and Cloud Security.

Exchange Server 2013Exchange Server 2016Description

This script removes Active Directory objects for HealthMailboxes or SystemMailboxes in the Microsoft Exchange System Objects (MESO) container that do not have a homeMDB attribute set.

It is highly recommended to run the script with -WhatIf parameter to check objects first.

Information about accounts deleted or supposed to be deleted are written to a log file.

Requirements

Examples

# EXAMPLE 
# Perform a WhatIf run in preparation to removing SystemMailboxes having an empty database attribute
.\Remove-OrphanedMailboxAccounts.ps1 -SystemMailbox -WhatIf
    
# EXAMPLE 
# Remove HealthMailbox(es) having an empty database attribute
.\Remove-OrphanedMailboxAccounts.ps1 -HealthMailbox

Example log file

2017-02-10 10:18: 11488      - Info     - Script started
2017-02-10 10:18: 11488      - Info     - WhatIf Preference: True
2017-02-10 10:18: 11488      - Info     - Cleaning HealthMailboxes | 10 objects found
2017-02-10 10:18: 11488      - Info     - Cleaning HealthMailboxes | Delete CN=HealthMailboxd32b165a6adf45518c8498fba3c7c93a,CN=Monitoring Mailboxes,CN=Microsoft Exchange System Objects,DC=granikoslabs,DC=de
2017-02-10 10:18: 11488      - Info     - Cleaning HealthMailboxes | Delete CN=HealthMailbox6b66930902d8430e831df7b086bfd49b,CN=Monitoring Mailboxes,CN=Microsoft Exchange System Objects,DC=granikoslabs,DC=de
2017-02-10 10:18: 11488      - Info     - Cleaning HealthMailboxes | Delete CN=HealthMailbox6bf99bdc31474217a6fdc4cd83260e88,CN=Monitoring Mailboxes,CN=Microsoft Exchange System Objects,DC=granikoslabs,DC=de
2017-02-10 10:18: 11488      - Info     - Cleaning HealthMailboxes | Delete CN=HealthMailboxd4410bf131b34907b6a96a7e65263db1,CN=Monitoring Mailboxes,CN=Microsoft Exchange System Objects,DC=granikoslabs,DC=de
2017-02-10 10:18: 11488      - Info     - Cleaning HealthMailboxes | Delete CN=HealthMailbox98f334580dbf457ca2a6d1a19fdf49d1,CN=Monitoring Mailboxes,CN=Microsoft Exchange System Objects,DC=granikoslabs,DC=de
2017-02-10 10:18: 11488      - Info     - Cleaning HealthMailboxes | Delete CN=HealthMailboxc16704bf98c94f5e8453c7955d7897b5,CN=Monitoring Mailboxes,CN=Microsoft Exchange System Objects,DC=granikoslabs,DC=de
2017-02-10 10:18: 11488      - Info     - Cleaning HealthMailboxes | Delete CN=HealthMailboxa64fe085bdff46a786d68782c5070bf1,CN=Monitoring Mailboxes,CN=Microsoft Exchange System Objects,DC=granikoslabs,DC=de
2017-02-10 10:18: 11488      - Info     - Cleaning HealthMailboxes | Delete CN=HealthMailbox6c56f94506974a1183c6b71eebb63406,CN=Monitoring Mailboxes,CN=Microsoft Exchange System Objects,DC=granikoslabs,DC=de
2017-02-10 10:18: 11488      - Info     - Cleaning HealthMailboxes | Delete CN=HealthMailbox9b6666d46aa746e3848f3240e418d731,CN=Monitoring Mailboxes,CN=Microsoft Exchange System Objects,DC=granikoslabs,DC=de
2017-02-10 10:18: 11488      - Info     - Cleaning HealthMailboxes | Delete CN=HealthMailboxb2bd3d4725b249bab81eeed35666de0f,CN=Monitoring Mailboxes,CN=Microsoft Exchange System Objects,DC=granikoslabs,DC=de
2017-02-10 10:18: 11488      - Info     - Script finished

Version History

  • 1.0, Initial community release

Links

Follow

 

Read More »
On February 17, 2017
0 Comment
884 Views

Office 365Microsoft AzureDescription

Using this script you can test the domain availability in Office 365 and Azure AD. As there are different closed Office 365 and Azure AD regions you need to test per dedicated closed Office 365 region.

Regions currently implemented:

  • Global
    This is the default public Office 365 cloud
  • Germany
    This is the dedicated Germany Cloud offering aka Office 365 Germany
  • China
    This is the Office 365 region hosted by VIANET21

The script queries the login uri for the selected Office 365 region.

The response contains metadata about the domain queried. If the domain already exists in the specified region the metadata contains information if the domain is verified and/or federated.

 Load function into your current PowerShell session:

. .\Test-DomainAvailability.ps1

 

Examples

# EXAMPLE
# Test domain availability in the default region - Office 365 Global

Test-DomainAvailability -DomainName example.com 

# EXAMPLE
# Test domain availability in Office 365 China    

Test-DomainAvailability -DomainName example.com -LookupRegion China

Version History

  • 1.0, Initial community release

Links

Additional Credits

Original source: https://blogs.technet.microsoft.com/tip_of_the_day/2017/02/16/cloud-tip-of-the-day-use-powershell-to-check-domain-availability-for-office-365-and-azure/

Follow

 

Read More »
On February 15, 2017
0 Comment
748 Views

Problem

When querying mailbox statistics in an Exchange organization using the following cmdlet (example) you might receive a warning that the object has been corrupted, and it's in an inconsistent state.

Get-Mailbox USER | Get-MailboxStatistics

WARNING: The object 3d16fdbb-5584-436b-b6c2-ee89adab9b9f has been corrupted, and it's in an inconsistent state. The following validation errors
happened:
WARNING: Cannot extract the property value of 'DeletedItemCount'. Source: PropTag(DeletedMsgCount), PropType(Int), RawValue(-11),
RawValueType(System.Int32). Target: Type(System.Nullable`1[System.UInt32]), IsMultiValued(False). Error Details: <n/a>

Solution

Check whether the affected mailbox is a regular user mailbox or if the mailbox is in a disconnected state. If the mailbox is disconnected you can either ignore the warning or remove the mailbox from the mailbox store.

If the mailbox is a regular user check the corresponding identity and move the mailbox to a different database.

Get-Mailbox -Identity 3d16fdbb-5584-436b-b6c2-ee89adab9b9f

Name                      Alias                ServerName       ProhibitSendQuota
----                      -----                ----------       -----------------
JohnDoe                   johndoe              MX01             1.8 GB (1,932,735,488 bytes)

Get-Mailbox johndoe | New-MoveRequest -TargetDatabase DB01

Enjoy.

 

 

Read More »
On February 13, 2017
0 Comment
575 Views

Exchange Server 2013Exchange Server 2016Description

This script helps administrators and support desk personnel to connect an Exchange Server 2013+ using remote PowerShell. You can either connect to a dedicated Exchange Server or connect to a randomly selected Exchange Server.

You can implement the function in your own scripts to connect to Exchange remotely. David Lee has written an excellent post about how to use saved credentials with PowerShell scripts.

Examples

# EXAMPLE
# Connect to the specified server EX01
./Connect-ToExchange.ps1 -Server EX01

# EXAMPLE
# Connect to a randomly selected server
./Connect-ToExchange.ps1

Version History

  • 1.0, Initial community release

Links

Follow

Read More »
On February 8, 2017
0 Comment
899 Views

Problem

Recently a colleague of mine found an interesting issue with an Exchange Server 2013 organization setup.

The local service desk personnel wasn't able to select a target organizational unit (OU) when creating new mailboxes. The ECP dialogue just showed an empty window.

Reason

By default the ECP OU picker result set contains 500 entries only.

The OU picker does not query the Active Directory with -ResultSize Unlimited.

Solution

Microsot Knowledge Base article 3038717 provides the solution for this issue.

When querying the local Active Directory for the overall number of organization units using the following command, it turned out that the Active Directory contained more than 4.000 OUs.

(Get-OrganizationUnit -ResultSize Unlimited).Count

Use this cmdlet to determine the current number of organization units and define a reasonable number for querying Active Directory.

Add a new key node to the ECP web.config file on each of your Exchange 2013 servers.

<appSettings>
	<!-- Provisioning Cache identification -->
	<add key="ProvisioningCacheIdentification" value="Ecp" />
	<!-- ALL OTHER LINES HAVE BEEN REMOVED AS THIS IS FOR REFERENCE ONLY -->
	<add key="AccountTerminationEnabled" value="false" />
	<!-- Enable legacy logout page. To enable new signoff page delete the entry. (3) -->
	<add key="LogonSettings.SignOutKind" value="LegacyLogOff" />
	<!-- Allow the OU picker for New-Mailbox to retrieve 5000 organization units from AD, default = 500 -->
	<add key="GetListDefaultResultSize" value="5000" />
</appSettings>

The ECP web.config file is located in

  • $exinstall\ClientAccess\ecp

Saving a modified web.config normally triggers an application pool restart. If required, use the following one-liner to restart the ECP application pool across all Exchange 2013 servers.

Get-ExchangeServer | ? { $_.AdminDisplayVersion -like '*15.*'} | % { Invoke-Command -ComputerName $_.Name -ScriptBlock {Restart-WebAppPool MSExchangeECPAppPool } }

Note

It has not yet been verified, if the issue is present with Exchange Server 2016 as well. If so, just let us know.

Links

Keep enjoying the oddities of Exchange Server.

 

 

 

 

Read More »