What smo.ScriptingOptions properties correspond to the Generate Script Wizard's defaults?

225 views Asked by At

I'm experimenting with dbatools, and comparing the output of export-dbascript to that of the SSMS "Generate Scripts" wizard. export-dbascript's behavior is controlled in part by an smo.ScriptingOptions object, and the ScriptingOptions defaults don't appear to match the Generate Scripts defaults. For example, I think the ScriptingOptions.withdependencies property corresponds to "Generate Script for Dependent Object" in the wizard, but the former is set to False by default and the latter to True.

What set of ScriptingOptions defaults differ from those of the wizard, and how would they have to be changed to mimic it?

1

There are 1 answers

0
Ben Thul On

I don't know what the defaults are because I'm sure I changed them in my local installation of SSMS, but you can see what you're using in SSMS by going to Tools → Options → SQL Server Object Explorer → Scripting.

Presumably, you're asking the question because you're scripting via that cmdlet and also via the wizard and coming up with different results. If that's the case, my suggestion would be to classify the differences and find the relevant property of the ScriptingOptions object and set it accordingly. Rinse, lather, repeat until you're happy.