/build/static/layout/Breadcrumb_cap_w.png

enumerate all machines in a NT 4 domain

Does anyone know of a fairly painless way to enumerate all the machine names in an NT4 domain?

BTW - I don't want to use "netview"; I don't want a list of what is currently connected, but a complete list of everything joined.


Craig --<>.

0 Comments   [ + ] Show comments

Answers (3)

Posted by: Garrett 18 years ago
Orange Belt
0
http://www.windowsitpro.com/Article/ArticleID/4734/4734.html?Ad=1

or

http://www.google.com/search?hl=en&q=winnt%3A%2F%2F++enumerate+all+computer+vbscript&btnG=Google+Search

There are a ton of scripts and examples out on the Information Superweb already.
Posted by: craig16229 18 years ago
Third Degree Brown Belt
0
Thanks.

Yes, I have been through many searches and read many of these articles. What they provide is suprisingly tricky to implement.

I ended up using Scalable Software's canned WMI tools in its Survey product to get what I needed. The only drawback is I cannot be certain that I caught everything, since the enumeration is dependent on the Survey Agent being on every workstation on the network, which is probably not the case.

BTW, the need for this enumeration is for a WSUS deployment in a non-AD environment.


Craig --<>.
Posted by: Garrett 18 years ago
Orange Belt
0
I use a script template so alot of the code below isnt needed. This will write a log file to the directory where the script is executed. The log file will contain all the computers in the domain specified. You will need to change one variable to make it work for your domain. In the code below there is a section called "' THESE ARE VARIABLES THAT MAY NEED TO BE CHANGED". In this section change the variable strDomainName to your domain.

If you have any problems with the script let me know.



'*****************************************************************************
'* Script Name:
'* Created on:
'* Author:
'* Purpose:
'* Usage:
'* Version:
'* Requirements:
'* History:
'*****************************************************************************

'* Strict use of variables
Option Explicit

'Checks to make sure the script is running in cscript.
'If the script is not running in cscript it is relaunched in cscript.
If Lcase(Right(Wscript.FullName, 12)) = "\wscript.exe" Then
CreateObject("Wscript.Shell").Run "cscript.exe " & Chr(34) & Wscript.ScriptFullName & Chr(34)
Wscript.Quit
End If

'Common variables
dim pathToLog, EnableLogging, Verbose, testingMode, continue, strScriptPath, _
strScriptName, strCurPath, objNetwork, objLogFile, objShell, _
objExplorer, objFSO, scriptVer, testingModeText, logName

'Script specific variables
dim strDomainComputer, objIADsContainer, objIADsComputer, strDomainName

'*****************************************************************************
' THESE ARE VARIABLES THAT MAY NEED TO BE CHANGED.
EnableLogging = True
'Script Version
scriptVer = "1.0.0.0"
'Define Log Name. The final name will be in the format logName_01-01-2001.log
logName = "TheLog"
'Add your WinNT domain name here
strDomainName = "theDOMAIN"
'*****************************************************************************

'Constants
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8

'Setup script variable paths
strScriptPath = Wscript.ScriptFullName
strScriptName = Wscript.ScriptName
strCurPath = Left(strScriptPath, Len(strScriptPath) - Len(strScriptName))
If Right(strCurPath,1)<>"\" Then strCurPath = strCurPath & "\"
'Path to log files
pathToLog = strCurPath & logName & "_" & replace(date,"/","-") & ".log"

'Default scripting objects
Set objShell = Wscript.CreateObject("Wscript.Shell")
Set objExplorer = CreateObject("InternetExplorer.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objNetwork = Wscript.CreateObject("Wscript.Network")

'If logging is enabled then create the log file
If EnableLogging Then
If objFSO.FileExists(pathToLog) Then
Set objLogFile = objFSO.OpenTextFile(pathToLog, ForAppending)
else
objFSO.CreateTextFile(pathToLog)
'Pause to let filesystem catchup
Do while not objFSO.FileExists(pathToLog)
wscript.sleep 250
loop
Set objLogFile = objFSO.OpenTextFile(pathToLog, ForAppending)
End If
End If

'Main code execution start
Main

'Cleanup
'Close the log file
objLogFile.Close
'Destroy objects
set objShell = nothing
set objExplorer = nothing
set objFSO = nothing
set objNetwork = nothing
'Uncomment to have the script pause before quitting.
'continue = wscript.stdin.readline
'Terminate cscript
wscript.quit

'****************************************************************
'Begin Subs and Functions

'Main code body
Sub Main()
'Displays info on the script and host
DisplayInfo
dispLog "Entering Main Code Body", True

Set objIADsContainer = GetObject("WinNT://" & strDomainName)
objIADsContainer.Filter = Array("Computer")

For Each objIADsComputer In objIADsContainer
dispLog objIADsComputer.Name, False
Next

'Final log entries
dispLog "Exiting Main Code Body", True
End sub

'Subs/Functions for Logging and Displaying Information
Sub DisplayInfo
wscript.stdout.writeline ""
wscript.stdout.writeline wscript.application & " Build: " & wscript.buildversion
wscript.stdout.writeline wscript.ScriptName & " Build: " & scriptVer
wscript.stdout.writeline "Working Directory " & strCurPath
wscript.stdout.writeline ""
If EnableLogging Then
objLogFile.writeline ""
objLogFile.writeline ""
objLogFile.writeline "-------------------- " & Now & " --------------------"
objLogFile.writeline Now & testingModeText & vbTab & wscript.application & " Build: " & wscript.buildversion
objLogFile.writeline Now & testingModeText & vbTab & wscript.ScriptName & " Build: " & scriptVer
objLogFile.writeline Now & testingModeText & vbTab & "Working Directory " & strCurPath
end if
End sub

Sub dispLog(message, showTime)
If showTime = True then
wscript.stdout.writeline testingModeText & message
If EnableLogging Then objLogFile.writeline Now & vbTab & message
else
wscript.stdout.writeline message
If EnableLogging Then objLogFile.writeline vbTab & message
end if
End Sub
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ