Re: Determining what Computer accounts are active
AKrinn,
You could do the following. I use this as a part of my script that scans all machines in the domain and checks to see if they have a service missing (like Anti-virus). This produces a .tmp file that can be parsed for the active computers. Not 100%, as it basically relies on the the browser service, but it's a start:
'***************************************
strTempFile = "c:\~" & strDomain & ".tmp"
' Check whether the file exists.
If (fso.FileExists(strTempFile)) Then ' File exist; delete it (it will be created by the command itself)
fso.DeleteFile(strTempFile)
End If
strRunPath = "cmd /c net view /domain:" & strDomain & " > " & strTempFile
WshShell.Run(strRunPath)
WScript.Sleep(1000) ' pause to allow the Run command to complete
'***************************************
You can parse the file like this:
'***************************************
Set objTempFile = fso.OpenTextFile(strTempFile, 1, false)
'read until the end of the file
While Not objTempFile.AtEndOfStream
strTempLine = objTempFile.ReadLine
'MsgBox Left(strTempLine,2)
If Left(strTempLine,2) = "\" Then
strComputer = Mid(Trim(Left(strTempLine,23)),3)
'**** here, add whatever you need to do to the computer name (like add it to your SQL database??)
End If
Wend
objTempFile.Close
'***************************************
Hope this helps!!
Joel
Announcement
Collapse
No announcement yet.
Determining what Computer accounts are active
Collapse
X
-
Guest replied
-
Determining what Computer accounts are active
I have a task: To make a list of all computer accounts in an NT 4 domain and flag them as active or inactive.
I have a script that I ran once a day at different times that gives me this output and then put in into a SQL database and any computer account that has an active for any read will not get nuked. The script takes 6 hours to complete. Is there some property that Hyena uses to determine if an account is online or not? I know the greyed out ones are "offline" How do you determine if the commputer is offline and are able to refresh this so fast. I do not know of any ADSI property that has this.Tags: None
Leave a comment: