Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. Add-Type -AssemblyName "Microsoft.SqlServer.RMO, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"
  2.  
  3. $SqlServer = "PRODSQL23i1"
  4.  
  5. $scriptargs = [Microsoft.SqlServer.Replication.scriptoptions]::Creation `
  6. -bor [Microsoft.SqlServer.Replication.scriptoptions]::EnableReplicationDB `
  7. -bor [Microsoft.SqlServer.Replication.scriptoptions]::IncludeCreateLogreaderAgent `
  8. -bor [Microsoft.SqlServer.Replication.scriptoptions]::IncludePublications `
  9. -bor [Microsoft.SqlServer.Replication.scriptoptions]::IncludeCreateSnapshotAgent `
  10. -bor [Microsoft.SqlServer.Replication.scriptoptions]::IncludePublicationAccesses `
  11. -bor [Microsoft.SqlServer.Replication.scriptoptions]::IncludeArticles `
  12. -bor [Microsoft.SqlServer.Replication.scriptoptions]::IncludePublisherSideSubscriptions `
  13. -bor [Microsoft.SqlServer.Replication.scriptoptions]::IncludePullSubscriptions
  14.  
  15. $repsvr=New-Object "Microsoft.SqlServer.Replication.ReplicationServer" -Debug
  16. $repsvr.ConnectionContext = $SqlServer
  17.  
  18. $Production = $repsvr.ReplicationDatabases | Where-Object {$_.Name -eq "Production"}
  19. $ProductionGroup8 = $Production.TransPublications | Where-Object {$_.Name -eq "Production - Group 8"}
  20.  
  21. $ProductionGroup8.script($scriptargs)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement