#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.
Powershell
$Subnets = Get-Content "C:\Temp\subnets.txt" foreach ($subnet in $subnets) { write-host "Subnet: $subnet" Add-DnsServerPrimaryZone -DynamicUpdate Secure -NetworkId "$subnet" -ReplicationScope Domain }
Export
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-MailboxExportRequestClear Completed Import Request
Get-MailboximportRequest | where {$_.status -eq "Completed"} | Remove-MailboxImportRequest
Search-Mailbox -Identity "username" -DeleteContent -force
Code to format date as 01/01/2016 for use in naming log file
$today = (get-date).tostring("MM-dd-yyyy")Code to format date in the past
get-date).AddDays(-365).tostring("MM/dd/yyyy")
When running RedistributeActiveDatabases.ps1 if you receive the following error… restart powershell.
New-Object : Cannot find type [HADatabaseLoadBalancing.DatabaseMoveStatus]: make sure the assembly containing this type
is loaded.
At C:\Program Files\Microsoft\Exchange Server\V14\Scripts\RedistributeActiveDatabases.ps1:648 char:70
+ [HADatabaseLoadBalancing.DatabaseMoveStatus]$moveStatus = New-Object <<<< -TypeName "HADatabaseLoadBalancing.Dat
abaseMoveStatus"
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
Get-Content C:\scripts\users-to-move.txt | New-MoveRequest -TargetDatabase archive01
Change throttling settings for specific users
New-ThrottlingPolicy –Name "HyperConnected ActiveSync" –EASMaxDevices 40 –EASMaxConcurrency 40 Set-ThrottlingPolicyAssociation -Identity tonysmith -ThrottlingPolicy </code><code>"HyperConnected ActiveSync"
$FixAutoMapping = Get-MailboxPermission -Identity discovery | where {$_.AccessRights -eq "FullAccess" -and $_.IsInherited -eq $false}
$FixAutoMapping | Remove-MailboxPermission
$FixAutoMapping | ForEach {Add-MailboxPermission -Identity $_.Identity -User $_.User -AccessRights:FullAccess -AutoMapping $false}
$today = (get-date).tostring("MM-dd-yyyy")
$outfile = 'C:\logs\FileName_' + $today + '.log'