Question

Why does this work:

$cmd = new-object System.Data.OleDB.OleDbCommand

and why doesn't this:

$sql = new-object Microsoft.SqlServer.SMO

How do I know which classes need this "special" treatment?

No correct solution

OTHER TIPS

SMO isn't a class, it's a namespace. You need to instantiate an object in the namespace. For instance, if you wanted a server, you'd do:

$server = new-object Microsoft.SqlServer.Management.Smo.Server "yourServer";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top