Execution Flow
CRITICAL: Run this BEFORE the AD/cluster team deletes the listener cluster resource. Skipping this step causes all AG databases to enter RECOVERY MODE when the cluster resource is deleted. After execution, wait 15–30 minutes for DNS TTL expiry before the cluster team proceeds.
This is an alias for
Invoke-sqmListenerMigrationPrep. The second half of the migration workflow is handled by Move-sqmAlwaysOnListener / Complete-sqmListenerMigration.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| -SqlInstance | String | Optional | Primary replica hosting the AG. Default: $env:COMPUTERNAME. |
| -AvailabilityGroupName | String | Required | Name of the Availability Group. |
| -ListenerName | String | Optional | DNS name of the specific listener to remove. If omitted, the first listener on the AG is used. |
| -SqlCredential | PSCredential | Optional | SQL authentication credential. |
| -OutputPath | String | Optional | Directory for the AD-team instruction report. Default: C:\System\WinSrvLog\MSSQL. |
| -EnableException | Switch | Optional | Throws terminating errors instead of returning a Failed status object. |
| -WhatIf / -Confirm | Switch | Optional | Standard ShouldProcess support (ConfirmImpact=High). |
Return Value
Returns a PSCustomObject with: Status (READY_FOR_AD_TEAM / CANCELLED / FAILED), SqlInstance, AvailabilityGroup, ListenerName, ListenerIpOld, ListenerPort, ListenerSubnet, DatabaseCountTotal, DatabaseCountOnline, Timestamp, DocumentationFile, NextStep, WaitTimeMinutes.
Examples
Example 1 — Prepare listener for migration (step 1 of 2)
Prepare-sqmListenerForMigration -SqlInstance "SQL01" -AvailabilityGroupName "ProdAG"
# Step 2: Wait 15-30 min for DNS TTL. AD team recreates cluster resource.
# Step 3: Run Move-sqmAlwaysOnListener / Complete-sqmListenerMigration
Example 2 — Preview without changes
Prepare-sqmListenerForMigration -SqlInstance "SQL01" -AvailabilityGroupName "ProdAG" -WhatIf