script smo triggers

Hello,

I search to exclude specific trigger like MsMerge before generate script
$scrp = new-object ('Microsoft.SqlServer.Management.Smo.Scripter') ("SQLTEST\TEST")
$scrp.Options.DriPrimaryKey=$true
$scrp.Options.Triggers=$true
$scrp.Options.AppendToFile=$true
$scrp.Options.FileName="D:\ddl\triggers_ddl.sql"

Thanks

Regards
bibi92Asked:
Who is Participating?
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Your choices are either to export everything, then apply a text filter to remove unwanted content, or script each object individually. You can't exclude specific objects from the scripter.

Here I would use a mixed approach: script everything but triggers, then add each trigger to the script.
0
 
bibi92Author Commented:
Thanks. How can I apply a text filter to remove unwanted content?
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Why not going with the last suggestion? It is much easier to write up and maintain ...
0
 
bibi92Author Commented:
Maybe more simple.
0
 
bibi92Author Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.