SQL DMO issue / Start - Stop SQL
Hi,
Looking for some help on a Stop / Restart of SQL Server via the DMO model. Problem :
. NT account does not have administrative rights.
So basically, I would need to Stop / Start SQL by means of the SA account. In additon, I would prefer to use the SQLServer.Shutdown method over the Stop method.
The fact that the sa account is hardcoded in the script does not harm.
The purpose of this undertaking is to reset the SQL server before running some maintenance scripts. Problem we have seen is that SQL sometimes seem to 'hang' on manual shutdown. Like if it just consumes too much RAM.
<<<
Set oSQLServer = CreateObject("SQLDMO.Sqlserver")
oSQLServer.Name = "."
oSQLServer.LoginSecure = False
'oSQLServer.Connect ".", "sa", "xxxxx"
oSQLServer.Stop
Wscript.Sleep 5000
oSQLServer.Start FALSE
'True, ".", "sa", "xxxxx"
>>>
The code I'm struggling with ...
Thanks for your input on this,
Sebastiaan.
|