I wrote this a fair few years ago, it's for those environments still running SMS2003 who opted to use Normal Security (Service Accounts, harking back to SMS 2.0 here!) instead of using Advanced Security (computer accounts).
The script, all it does is pump out what Service Accounts are in use on each of the site servers in the hierarchy, but first it requires a PREINST /DUMP to be performed from the Central Site server so that the Site Control Files for all Sites in the hierarchy can be queried.
Instructions:
Save the file to C:\SiteControlFiles\CheckServiceAccounts.vbs
Use PREINST /DUMP, get the resulting files from the root of the SMS drive, put them Site Control Files (CT0's) into C:\SiteControlFiles, then run this script from that folder in a CMD prompt using CSCRIPT and not WSCRIPT:
' Perform a PREINST /DUMP on the SMS Central to obtain all Site Control Files
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, ts, fc, f, f1
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("C:\SiteControlFiles")
Set fc = f.Files
WScript.Echo "SiteCode,Site Server,Service Account"
For Each f1 in fc
If MID(f1.name, LEN(f1.name)-2, 3) = "ct0" Then
DisplayString = LTRIM(RTRIM(f1.name & ","))
Set ts = fso.OpenTextFile("C:\SiteControlFiles\" & f1.name, ForReading)
Do While NOT ts.AtEndOfStream
tempvar = ts.ReadLine
If tempvar = "BEGIN_SITE_DEFINITION" Then
For i = 0 to 10
tempvar = LTRIM(RTRIM(ts.ReadLine))
if i = 2 then SiteName = LTRIM(RTRIM(tempvar))
Next
DisplayString = DisplayString & SiteName & "," & tempvar
Exit Do
End If
Loop
DisplayString = Replace(DisplayString, "sitectrl_","")
DisplayString = Replace(DisplayString, ".ct0","")
DisplayString = Replace(DisplayString, "<","")
DisplayString = Replace(DisplayString, ">","")
WScript.Echo DisplayString
ts.close
Set ts = Nothing
End If
Next
I guess this could be done more elegenty via a WMI script, I might look in to that, but considering that this is old tech I probably won't bother!
Read the complete post at http://wmug.co.uk/blogs/r0b/archive/2011/04/28/sms2003-service-accounts-being-used.aspx