You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: public/Get-DbaReplSubscription.ps1
+98-1Lines changed: 98 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,8 @@ function Get-DbaReplSubscription {
6
6
.DESCRIPTION
7
7
Retrieves detailed information about replication subscriptions, showing which subscriber instances are receiving data from publications. This is essential for monitoring replication topology, troubleshooting subscription issues, and auditing data distribution across your SQL Server environment. You can filter results by database, publication name, subscriber instance, subscription database, or subscription type (Push/Pull) to focus on specific replication relationships.
8
8
9
+
Pull subscriptions that exist only in the distribution database (but not in the publisher's syssubscriptions) are also returned, to handle cases where subscriptions were set up outside the normal creation process.
10
+
9
11
.PARAMETERSqlInstance
10
12
The target SQL Server instance or instances.
11
13
@@ -149,6 +151,9 @@ function Get-DbaReplSubscription {
149
151
Stop-Function-Message "Error occurred while getting publications from $instance"-ErrorRecord $_-Target $instance-Continue
150
152
}
151
153
154
+
# Track subscriptions already emitted to avoid duplicates from the distribution DB check
155
+
$foundSubscriptionKeys=@{}
156
+
152
157
try {
153
158
foreach ($subsin$publications.Subscriptions) {
154
159
Write-Message-Level Verbose -Message ('Get subscriptions for {0}'-f$sub.PublicationName)
@@ -166,6 +171,9 @@ function Get-DbaReplSubscription {
0 commit comments