># Setting the parameters 
Param (
[Parameter(Mandatory=$true)]
[string]$Username
)


# Import the tools to work with AD.
Import-Module ActiveDirectory

# Get Primary Proxy Address.
$user = Get-ADUser -Identity $username  -Properties proxyAddresses
$primarySMTPAddress = ""
foreach ($address in $user.proxyAddresses)
{
    if (($address.Length -gt 5) -and ($address.SubString(0,5) -ceq 'SMTP:'))
    {
        $primarySMTPAddress = $address.SubString(5)
        break
    }
}
$primarySMTPAddress
 
# Setting the parameters 
Param (
[Parameter(Mandatory=$true)]
[string]$Username
)

#
# Import the tools to work with AD.
#
Import-Module ActiveDirectory

#
# Disabled, exprire then reset password the account
#
Disable-ADAccount -Identity $Username
Set-ADAccountExpiration -Identity $Username -DateTime "11/12/2011"
Set-ADAccountPassword -Identity $Username -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "newpassword" -Force)
#Add Exchange snapin if not already loadedif (!(Get-PSSnapin | where {$_.Name -eq "Microsoft.Exchange.Management.PowerShell.E2010"}))

{

Write-Verbose "Loading the Exchange snapin"

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction SilentlyContinue

. $env:ExchangeInstallPath\bin\RemoteExchange.ps1

Connect-ExchangeServer -auto -AllowClobber

}
script by Paul Cunnigham.
Export
New-MailboxExportRequest -Mailbox user_name -FilePath \\exdag01\c$\export\user_name.pst
Check Export Status
Get-MailboxExportRequest | Get-MailboxExportRequestStatistics
Import
New-MailboxImportRequest -FilePath \\exdag01\c$\export\user_name.pst -Mailbox user_name
Check Import Status
Get-MailboxImportRequest | Get-MailboxImportRequestStatistics | select filepath, status
Clear Completed Export Request
Get-MailboxExportRequest | where {$_.status -eq "Completed"} | Remove-MailboxExportRequest
Clear Completed Import Request
Get-MailboximportRequest | where {$_.status -eq "Completed"} | Remove-MailboxImportRequest
To move the CBT files and consolidate snapshots:
  1. SSH to Host
  2. Navigate to the VM folder using this command: cd /vmfs/volumes/datastore/virtual_machine/
  3. Create a temporary directory for the CBT files. mkdir temp
  4. Move the CBT files to temp directory. mv *-ctk.vmdk temp/
  5. Run the snapshot consolidation again.