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
{{ message }}
Repository navigation
Commit f3280a3
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: public/Sync-DbaAvailabilityGroup.ps1
+20-1Lines changed: 20 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -90,6 +90,16 @@ function Sync-DbaAvailabilityGroup {
90
90
Disables all synchronized jobs on secondary replicas after copying them from the primary.
91
91
Use this when jobs should only run on the primary replica or when you need to manually control which jobs run on each replica after failover.
92
92
93
+
.PARAMETERUseJobLastModified
94
+
Passed through as -UseLastModified to Copy-DbaAgentJob for the AgentJob sync only; no other object type is affected.
95
+
Instead of skipping every job that already exists on a secondary (or recreating all of them with -Force), jobs are compared
96
+
by definition - properties, enabled state, steps and schedules - and only those that actually differ are updated, with the
97
+
primary winning when it is not older than the secondary. Jobs that differ only in enabled state are updated in place.
98
+
When combined with -Force, this switch takes precedence for jobs: existing jobs are still only updated when their definition
99
+
differs, and -Force only suppresses prompts and remaps missing job owners to sa, while -Force continues to drop and recreate
100
+
all other object types as usual.
101
+
See Copy-DbaAgentJob for the full behaviour.
102
+
93
103
.PARAMETERInputObject
94
104
Accepts availability group objects from Get-DbaAvailabilityGroup for pipeline processing.
95
105
Use this to sync multiple availability groups at once or to process specific AGs returned by filtering commands.
@@ -102,6 +112,7 @@ function Sync-DbaAvailabilityGroup {
102
112
.PARAMETERForce
103
113
Drops and recreates existing objects on secondary replicas instead of skipping them.
104
114
Use this when you need to update objects that already exist on secondaries or when objects have configuration differences that need to be synchronized.
115
+
For agent jobs, -UseJobLastModified takes precedence when both are specified.
105
116
106
117
.PARAMETERWhatIf
107
118
Shows what would happen if the command were to run. No actions are actually performed.
@@ -154,6 +165,12 @@ function Sync-DbaAvailabilityGroup {
0 commit comments