Skip to content
This repository has been archived by the owner on Sep 19, 2022. It is now read-only.

Commit

Permalink
Update dbusers.vbs
Browse files Browse the repository at this point in the history
Add user and password for SQL login
  • Loading branch information
theoricher committed Nov 6, 2019
1 parent 6cd9c1a commit 59b34e8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions agent/dbusers.vbs
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
strComputer = "localhost"
strUser = ""
strPassword = ""

Set objConnection = CreateObject("ADODB.Connection")

objConnection.Open _
"Provider=SQLOLEDB;Data Source=" & strComputer & ";" & _
"Trusted_Connection=Yes;Initial Catalog=Master"
"Provider=SQLOLEDB.1;Data Source=" & strComputer & ";Initial Catalog=Master;user id ='" & strUser & "';password='" & strPassword & "'"

Set objRecordset = objConnection.Execute("SELECT Name, is_disabled FROM master.sys.server_principals")
If objRecordset.Recordcount = 0 Then
Wscript.Echo ""
Else

Do Until objRecordset.EOF
Wscript.Echo "<DBUSERS>"
Wscript.Echo "<NAME>" & objRecordset.Fields("Name") & "</NAME>"
Wscript.Echo "<IS_DISABLED>" & objRecordset.Fields("is_disabled") & "</IS_DISABLED>"
Wscript.Echo "<IS_DISABLED>" & objRecordset.Fields("is_disabled") & "</IS_DISABLED>"
objRecordset.MoveNext
rem objFilename.MoveNext
Wscript.Echo "</DBUSERS>"
Loop


End If

0 comments on commit 59b34e8

Please sign in to comment.