Hey Peeps,
I'm trying to use PowerShell and SMO objects to query the available instances of a SQL 2008 server.
I loaded the SQLWMIManagement class and then created a WMI.ManagedComputer object.
However, the server I'm connecting to requires a SQL username and password and I get an error when trying to set the password for the connection.
$m = new-object ('Microsoft.SQLServer.Management,SMO,WMI.ManagedComputer') 'TESTSERVER' $m.ConnectionSettings.username = "sa" $m.ConnectionSettings.SetPassword("password") $m.ServerInstances
I tried set_Username("sa") as well. However, both error out as access denied.
If I create a Smo.Server object and use the set_Login and set_Password I'm able to connect fine to the same server. However, the Smo.Server object requires me to define named instances and I would rather just query a server for all available instances which the ManagedComputer object should provide.
Any thoughs / suggestions?
Thanks.
|