• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

vbscritp Sql Impersonation

i have a vbscript to connect to the sqlServer
strDBServerName = "."
strDBName = "ScriptingGuysTestDB"

Set objSQLServer = CreateObject("SQLDMO.SQLServer")
objSQLServer.LoginSecure = True
objSQLServer.Connect strDBServerName

Set objDB = objSQLServer.Databases(strDBName)
WScript.Echo "Total Size of Data File + Transaction Log of DB " & strDBName
& ": " & objDB.Size & "(MB)"

How to i impersoante this to a specific user.
i tried
objSQLServer.LoginSecure = False
objSqlServer.Login = "UserName"
objSQLServer.Password = "Password"

but it didn;t work

My Computer

Users Who Are Viewing This Thread (Users: 1, Guests: 0)