VBScript - Get Computer Lists of NT Domain
Environment
Get whole computer host-names in the NT Domain
Version
2010JAN15
Reference
- NT Domain
Get whole computer host-names in the NT Domain
Version
2010JAN15
- Basically, get the hostname of the NT Domain
- It is based on http://www.activexperts.com/activmonitor/windowsmanagement/adsi/samples/
Option Explicit
'Write the domain computer lists
Sub ListConnectedComputers( strDomain )
Dim objPDC, objShell, objFSO, objFile, objComputer
Set objShell = WScript.CreateObject("WScript.Shell")
Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile("DomainComputersList.csv", true)
Set objPDC = GetObject("WinNT://" & strDomain )
objPDC.Filter = Array("Computer")
For Each objComputer In objPDC
objFile.WriteLine (objComputer.Name)
Next
End Sub
'main
Function main()
Dim strDomain
Do
strDomain = InputBox( "Please enter a Domain Name", "Input" )
Loop until strDomain <> ""
ListConnectedComputers( strDomain )
End Function
main()
Reference