Creating a SQL server Maintenance Plan without the wizard

There's no way (that I've ever seen) to create a maintenance plan without going through either the wizard or the the designer. It's not possible using SMO. You could create an SSIS package that will perform your maintenance plan tasks and deploy that during your installer. Based on your comments above, though, I would suggest writing a couple stored procedures that will perform your tasks. Anything you can do with maintenance plans, you can write TSQL for.


Rather than using maintenance plans, consider using home-grown stored procedures.

Here's an excellent example.

http://ola.hallengren.com/

(And don't shrink your data files).