How to Check and Move Primary Active Manager (PAM) in an Exchange DAG Using PowerShell

In an Exchange Server Database Availability Group (DAG)—across Exchange Server Subscription Edition (SE), Exchange 2019, and Exchange 2016—the Active Manager component runs inside the Microsoft Exchange Replication Service (MSExchangeRepl) on every DAG member.

Exactly one server in a DAG holds the Primary Active Manager (PAM) role at any given time, while all other DAG members hold the Standby Active Manager (SAM) role. After a Cumulative Update (CU) maintenance cycle, Windows patching reboot, or WAN link flap, the PAM role frequently moves to a secondary node or a Disaster Recovery (DR) Active Directory site.

In this guide, you will learn how PAM and SAM interact, how to identify which DAG member currently holds the PAM role, and how to safely move the PAM back to your preferred primary node using PowerShell.


Primary Active Manager (PAM) vs. Standby Active Manager (SAM) Architecture

Exchange Server DAG Active Manager Role Architecture
Windows Failover Cluster
Default "Cluster Group"
  • Holds Cluster Name Object (CNO) & Cluster IP
  • Whichever DAG node owns Cluster Group is the PAM
  • Requires Cluster Quorum to remain online
Active Role (1 Node per DAG)
Primary Active Manager (PAM)
  • Receives database topology & state change notifications
  • Executes Best Copy Selection (BCS) during failovers
  • Decides which passive copy mounts as active
All Other DAG Nodes
Standby Active Manager (SAM)
  • Monitors local Information Store & database health
  • Reports local failures immediately to the PAM
  • Answers RPC/HTTP client queries on active server location

Quick Comparison: PAM vs. SAM Responsibilities

Feature / ResponsibilityPrimary Active Manager (PAM)Standby Active Manager (SAM)
How Many Per DAG?1 (The owner of the Windows Failover Cluster's "Cluster Group")All other DAG members (N - 1 nodes)
Failover Decision EngineYes — runs Best Copy Selection (BCS) to choose which database copy activatesNo — detects local store/disk failure and requests failover from PAM
Cluster Group DependencyDirectly tied to the "Cluster Group" owner in Windows Failover ClusteringRuns inside MSExchangeRepl on every member node
Impact of Moving the RoleZero client or mail flow disruption (only moves cluster arbitration ownership)Node transitions seamlessly between SAM and PAM in under 2 seconds

Step 1: Check Which Exchange Server Currently Holds the PAM Role

You can verify the current PAM owner using three methods:

Method A: Exchange Management Shell (EMS)

Run Get-DatabaseAvailabilityGroup with the -Status switch to query the live cluster state:

POWERSHELL
# Check PAM across all DAGs in the organization
Get-DatabaseAvailabilityGroup -Status |
    Select-Object Name, PrimaryActiveManager, Servers, WitnessServer, WitnessDirectory |
    Format-Table -AutoSize

# Check a specific DAG (e.g., DAG01)
(Get-DatabaseAvailabilityGroup -Identity "DAG01" -Status).PrimaryActiveManager

Method B: Windows FailoverClusters PowerShell Module

Because the PAM role always follows the owner of the default Cluster Group, you can query Windows Failover Clustering directly (run PowerShell as Administrator):

POWERSHELL
Import-Module FailoverClusters

# View the current OwnerNode of the "Cluster Group" (PAM) and Cluster Quorum Witness
Get-ClusterGroup -Cluster "DAG01" -Name "Cluster Group" |
    Select-Object Cluster, Name, OwnerNode, State

Method C: Failover Cluster Manager GUI

  1. Open Failover Cluster Manager (cluadmin.msc) on any DAG member or management workstation.
  2. Connect to your DAG cluster name (e.g., DAG01.corp.domain.com).
  3. Click the root cluster node in the left pane and inspect Current Host Server under the Cluster Summary section—that server is your current Primary Active Manager (PAM).

Step 2: Move the PAM Role to Another DAG Server Using PowerShell

Moving the Primary Active Manager role is a safe, non-disruptive online operation—it does not dismount or move any active mailbox databases.

Open an elevated Exchange Management Shell or Windows PowerShell session and move the "Cluster Group" to your target primary datacenter node (e.g., SITEA-MBX01):

POWERSHELL
Import-Module FailoverClusters

# Move the PAM ("Cluster Group") to SITEA-MBX01
Move-ClusterGroup -Cluster "DAG01" -Name "Cluster Group" -Node "SITEA-MBX01"

# Verify the PAM has transitioned to SITEA-MBX01
Get-DatabaseAvailabilityGroup -Identity "DAG01" -Status |
    Select-Object Name, PrimaryActiveManager

Option 2: Move PAM Using Classic Cluster.exe CLI

If you are inside a standard elevated Command Prompt without the FailoverClusters PowerShell module loaded:

POWERSHELL
cluster.exe DAG01 group "Cluster Group" /move:SITEA-MBX01

Step 3: Production Script — Audit & Rebalance PAM to Primary Datacenter

In multi-site Exchange DAGs (Site A = Primary Datacenter, Site B = DR Datacenter), you always want the Primary Active Manager (PAM) hosted in the Primary AD Site alongside your primary File Share Witness (FSW) to minimize cross-WAN RPC arbitration latency.

Use this production PowerShell function to audit all DAGs and automatically move the PAM back to an online primary-site node if it drifted to DR during maintenance:

POWERSHELL
function Invoke-ExchangeDagPamHealthCheck {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $false)]
        [string]$DagIdentity = "*",

        [Parameter(Mandatory = $false)]
        [string]$PreferredSitePrefix = "SITEA-",

        [Parameter(Mandatory = $false)]
        [switch]$RemediatePamLocation
    )

    Import-Module FailoverClusters -ErrorAction Stop

    $Dags = Get-DatabaseAvailabilityGroup -Identity $DagIdentity -Status

    foreach ($Dag in $Dags) {
        $CurrentPam = $Dag.PrimaryActiveManager.Name
        $IsInPreferredSite = $CurrentPam -like "$PreferredSitePrefix*"

        $ClusterNodes = Get-ClusterNode -Cluster $Dag.Name
        $UpPreferredNodes = $ClusterNodes | Where-Object {
            $_.State -eq "Up" -and $_.Name -like "$PreferredSitePrefix*"
        }

        $StatusObj = [PSCustomObject]@{
            DAGName             = $Dag.Name
            CurrentPAM          = $CurrentPam
            InPreferredSite     = $IsInPreferredSite
            WitnessServer       = $Dag.WitnessServer
            OperationalServers  = ($Dag.OperationalServers | ForEach-Object { $_.Name }) -join ", "
            ActionTaken         = "None (Healthy)"
        }

        if (-not $IsInPreferredSite) {
            if ($RemediatePamLocation -and $UpPreferredNodes) {
                $TargetNode = ($UpPreferredNodes | Select-Object -First 1).Name
                Write-Host "[*] Moving PAM for '$($Dag.Name)' from '$CurrentPam' to preferred node '$TargetNode'..." -ForegroundColor Yellow
                Move-ClusterGroup -Cluster $Dag.Name -Name "Cluster Group" -Node $TargetNode | Out-Null
                $StatusObj.ActionTaken = "Moved PAM to $TargetNode"
                $StatusObj.CurrentPAM  = $TargetNode
                $StatusObj.InPreferredSite = $true
            } else {
                $StatusObj.ActionTaken = "Warning: PAM is on non-preferred node ($CurrentPam)"
            }
        }

        $StatusObj
    }
}

# Example 1: Audit PAM location across all DAGs
# Invoke-ExchangeDagPamHealthCheck -PreferredSitePrefix "SITEA-"

# Example 2: Automatically move PAM back to a healthy primary-site node
# Invoke-ExchangeDagPamHealthCheck -PreferredSitePrefix "SITEA-" -RemediatePamLocation