A function to merge or join two objects. For example, to merge an entry from "Get-MailboxStatistics" with information about storage limits set on the account in Active Directory. This small function demonstrates how the Property members of two objects might be merged. Common properties on the additional object are discarded.

function Merge-Object {


    foreach ($property in $Additional.PSObject.Propeties) {
        $Base | Add-Member $property.Name -Value $property.Value -Force

Usage example

PS> $MailboxStats = Get-MailboxStatistics "Chris Dent"
PS> $UserInfo = Get-QADUser "Chris Dent" -IncludedProperties mDBUseDefaults, mDBOverQuotaLimit |
    Select-Object DN, mDBUseDefaults, mDBOverQuotaLimit
PS> Merge-Object $MailboxStats $UserInfo