Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Add-Type -AssemblyName "Microsoft.SqlServer.RMO, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"
- $SqlServer = "PRODSQL23i1"
- $scriptargs = [Microsoft.SqlServer.Replication.scriptoptions]::Creation `
- -bor [Microsoft.SqlServer.Replication.scriptoptions]::EnableReplicationDB `
- -bor [Microsoft.SqlServer.Replication.scriptoptions]::IncludeCreateLogreaderAgent `
- -bor [Microsoft.SqlServer.Replication.scriptoptions]::IncludePublications `
- -bor [Microsoft.SqlServer.Replication.scriptoptions]::IncludeCreateSnapshotAgent `
- -bor [Microsoft.SqlServer.Replication.scriptoptions]::IncludePublicationAccesses `
- -bor [Microsoft.SqlServer.Replication.scriptoptions]::IncludeArticles `
- -bor [Microsoft.SqlServer.Replication.scriptoptions]::IncludePublisherSideSubscriptions `
- -bor [Microsoft.SqlServer.Replication.scriptoptions]::IncludePullSubscriptions
- $repsvr=New-Object "Microsoft.SqlServer.Replication.ReplicationServer" -Debug
- $repsvr.ConnectionContext = $SqlServer
- $Production = $repsvr.ReplicationDatabases | Where-Object {$_.Name -eq "Production"}
- $ProductionGroup8 = $Production.TransPublications | Where-Object {$_.Name -eq "Production - Group 8"}
- $ProductionGroup8.script($scriptargs)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement