Free for PREMIUM members
Managing Active Directory does not always have to be complicated. If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why
Const FOR_READING = 1
strServersFile = "servers.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strServersFile) Then
Set objTextStream = objFSO.OpenTextFile(strServersFile, FOR_READING)
WScript.Echo "Input file " & strServersFile & " not found."
Do Until objTextStream.AtEndOfStream
strComputer = objTextStream.ReadLine
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colAccounts = objWMIService.ExecQuery _
("Select * From Win32_UserAccount Where Domain = '" & strComputer & "'")
For Each objAccount in colAccounts
If Left (objAccount.SID, 6) = "S-1-5-" and Right(objAccount.SID, 4) = "-500" Then
Open in new window
New feature! Upgrade and increase expert visibility of your issues with Priority Questions.