I'm Rob Marshall, a consultant who specialises in the Microsoft System Center Configuration Manager product. I like to share, i do so by blogging and helping out when I can in the MS SMS newsgroups and participating in the ConfigMgr MVP program.
I was awarded and joined the program in 2009. It'd be an understatement to say it has to be one of the best experiences an IT engineer can have, if they really enjoy specialising in a product.
My biggest weapon for troubleshooting is, my formidable knowledge, no, only joking, you, the community. I find if I cannot answer a question, then I can usually find the answer from using Bing\Google, pouring over the documentation, and if that doesn't work, tinkering in mine or someone elses virtual lab.
The blogs pretty much about ConfigMgr, but it is also a platform for me to express my random urges to display something I've stumbled across, and that I imagine would entertain you or what not as equally as it did me.
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
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!