Pages

Saturday, September 17, 2016

Useful commands for Migration



setexchange server
Set-ExchangeServer -identity targettestexchange.targettest.local -StaticExcludedDomainControllers:targettestdc01.targettest.local,targettestdc02.targettest.local,targettestdc03.targettest.local
Get-ExchangeServer -identity targettestexchange.targettest.local -status | fl Name, StaticExcludedDomainControllers
Set-ExchangeServer -identity targettestexchange.targettest.local -StaticExcludedDomainControllers:$null

Full access

Get-mailbox –OrganizationalUnit “test users”| Add-MailboxPermission –user “testtest005” –accessright Fullaccess

[PS] C:\Windows\system32>get-mailboxserver | where {$_.name -like "targettestexchange*"} |Get-mailboxStatistics | where {$_.DisconnectDate -notlike "" -and $_.Displayname -notlike "*test*"} | sort LastLogonTime | ft DisplayName, LastLogonTime, Database -wrap

[PS] C:\Windows\system32>Get-Mailbox -OrganizationalUnit "test users" | Set-Mailbox -HiddenFromAddressListsEnabled $true

Get-Group  | Where {$_.GroupType -eq "Global"} | Set-Group -Universal

Import-csv -path c:\temp\groups.csv | foreach { Enable-distributiongroup -identity $_.Identity}

Get-DistributionGroup -| Set-DistributionGroup -EmailAddressPolicyEnabled $False

[PS] C:\Windows\system32>Get-DistributionGroup -OrganizationalUnit "test groups" | Set-DistributionGroup -EmailAddressPolicyEnabled $False

Get-mailuser -OrganizationalUnit "test users" | Set-mailuser -EmailAddressPolicyEnabled $True

Get-mailbox -OrganizationalUnit "test users" | Set-mailbox -EmailAddressPolicyEnabled $True

Cross-forest Maibox move Migration commands


$User = "test.loc\vijaya.reddy"
$PWord = ConvertTo-SecureString –String "SourcePWD" –AsPlainText -Force

$SourceCredential = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $User, $PWord

$User = "targettest.local\vijaya.reddy"
$PWord = ConvertTo-SecureString –String "TargetPWD" –AsPlainText -Force


$TargetCredentials = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $User, $PWord

Import-csv "C:\temp\moveusers.csv" | Foreach-Object { Move-Mailbox -TargetDatabase "exchange\First Storage Group\Mailbox Database" -Identity $_.Identity -GlobalCatalog testdc03.test.local -SourceForestGlobalCatalog testdc02.test1.loc -NTAccountOU "OU=test Users,DC=test,DC=local" -SourceForestCredential $SourceCredential -TargetForestCredential $TargetCredential -IgnorePolicyMatch:$true -BadItemLimit 1000 -maxthreads 50 -verbose -Confirm: $false}

Perform DAG Maintenance & Health Check for an Exchange Server 2016/2013/2010 Environment Using GUI tool

The DAGMaintenace_Healthcheck.exe will use PowerShell to Perform DAGMaintenace and HealthCheck against an Exchange Server 2010 or 2013 or 2016. This tool will detect target hubtransport server automatically to transfer the message queue.

********************** Functions ********************
1.Start DAG Maintenance ::  Place the current Exchange Server in to Maintenance Mode.
2.Stop DAG Maintenance ::  Place the current Exchange Server in to out of Maintenance Mode.
3.Rebalance Mailbox Databases ::  Balance the Mailbox Databases based on activation preference.
4.Check Exchange Server Health Check ::  Perform Exchange Server Health Checks.
5.Reboot Current Server ::  Reboot the current Exchange Server.
******************************************************

Email-Removal-Tool for Exchange server

Remove spam emails from your organization mailboxes from all mailboxes or specific mailboxes. You must have member of  Discovery Management and Mailbox Import Export role


This tool will perform the following functions.
  • Delete messages from the source mailbox. You have to be assigned the Mailbox Import Export management role to delete messages.
  • Copy messages from the source mailbox and delete them from the target mailbox.

Exchange Migration Commands


Get-MoveRequest -MoveStatus Completed | Remove-MoveRequest

Get-MoveRequest | where {$_.Status -eq "autosuspended"} | Resume-MoveRequest

Get-MoveRequest | where {$_.Status -eq "CopyingMessages"}

Get-MoveRequest | where {$_.Status -ne "Completed"} | suspend-moverequest -Confirm: $false

Get-MoveRequest | where {$_.Status -ne "Completed"} | resume-moverequest

Get-MoveRequest | where {$_.Status -ne "Completed"} | get-moverequeststatistics

Get-Mailbox –Database “Apmexchange\First Storage Group\Mailbox Database” –OrganizationalUnit “users” | New-Move Request –TargetDatabase “DB01”

Get-MoveRequestStatistics -identity test004

Get-Content C:\temp\mapsusers.txt | New-MoveRequest -Identity $_.Identity -TargetDatabase "DB01"

Import-csv C:\temp\musers.csv | foreach-object {New-MoveRequest -Identity $_.Identity -TargetDatabase "DB01" -LargeItemLimit 20 -BadItemLimit 100 -BatchName "TEST01" -AcceptLargeDataLoss}

Remove-MoveRequest -Identity 'user@domain.com'