SyntaxHighlighter Evolvedand here
SyntaxHighlighter Evolved
SyntaxHighlighter Evolvedand here
SyntaxHighlighter Evolved
># 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)
Get-ExchangeServer |
    ?{$_.IsHubTransportServer -eq $true} |
    Get-Queue |
    get-message |
    ? {$_.sender -eq 'Vinc@somedomain.uhoh'} |
    Remove-Message -withNDR $false
	#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.	$Subnets = Get-Content "C:\Temp\subnets.txt"
foreach ($subnet in $subnets)
    {
    write-host "Subnet: $subnet" Add-DnsServerPrimaryZone -DynamicUpdate Secure -NetworkId "$subnet" -ReplicationScope Domain
     }      
	New-MailboxExportRequest -Mailbox user_name -FilePath \\exdag01\c$\export\user_name.pstCheck Export Status
Get-MailboxExportRequest | Get-MailboxExportRequestStatisticsImport
New-MailboxImportRequest -FilePath \\exdag01\c$\export\user_name.pst -Mailbox user_nameCheck Import Status
Get-MailboxImportRequest | Get-MailboxImportRequestStatistics | select filepath, statusClear Completed Export Request
Get-MailboxExportRequest | where {$_.status -eq "Completed"} | Remove-MailboxExportRequest
Clear Completed Import Request
Get-MailboximportRequest | where {$_.status -eq "Completed"} | Remove-MailboxImportRequest