Set wshshell = CreateObject("WScript.Shell"
Set fso = CreateObject("Scripting.FileSystemObject"
Domain = inputbox ("Type Your Domain"
listdes = InputBox ("type destination for log"
if Domain = "" Then
MsgBox("Nothing Typed"
Else
Call GetDomain
Set infile = fspenTextFile (listdes, ForReading, True) 'opens file for reading
Do While infile.AtEndOfStream <> True
If infile.AtEndOfStream <> True Then
strServername = Trim(infile.ReadLine)
End if
Loop
Sub GetDomain 'Gets a list of servers from the defined domain and writes to a file
Const TemporaryFolder = 2
Set TempFile = fspenTextFile (listdes, ForWriting, True)
Set DomainObj = GetObject("WinNT://" & domain)
For Each Object In DomainObj
If Object.class = "Computer" then
'WScript.Echo(Object.name)
TempFile.Writeline(Object.name)
Else
End If
whyme = Wscript.Echo(Object.Name)
Next
End Sub
sorry remove the bit that says whyme = wscript.echo because that gives you the usernames and the other wscript command in there will bring up the box. Otherwise it should log all computer accounts on the domain to the file you specify
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.