Please help me with the script. I spent few days and couldn't find the
problem. Maybe someone can see better than me.
Tia, BigLL
Script
---------------------------------------------
'This script will poll all PCs in the domain.
'Extract specified data from their registries,
'Separate the data with a delimiter, and
'Save the results into the specified file.
'Declare variables
DIM Serv, domname, Dom, CRLF, oArgs
'Set variables
nextline = CHR("13")
spacer = CHR("9")
CRLF = Chr(13) & Chr(10)
set WshShell = CreateObject("WScript.Shell")
Const ForReading = 1, ForWriting = 2, ForAppending = 8
'Get the command line args
set oArgs=wscript.arguments
IF oArgs.Count = 0 THEN
domname = InputBox("This scripts takes domain name as a parameter"
&
CRLF & "and gets all computer names from the Windows NT domain via ADSI."
&
CRLF & "Type in the Domain Name" & CRLF & "Sample MyDomainName")
'Else file containing users is the first argument
ELSE
domname = oArgs.item(0)
END IF
IF domname = "" THEN
WScript.Echo "No domain name provided. Stopping the script now."
WScript.Quit(1)
END IF
'Enter your domain name here
SET Dom = GetObject("WinNT://" & domname)
Dom.Filter = Array("computer")
'File open
SET fs = CreateObject("Scripting.FileSystemObject")
'If the file exists then open in append mode
if fs.FileExists("c:\DomainCompInfo.txt") THEN
SET f = fs.OpenTextFile("c:\DomainCompInfo.txt", ForAppending,
TristateFalse)
f.WriteLine(addText)
'Else create a new file and write the information
ELSE
Set f = fs.CreateTextFile("c:\DomainCompInfo.txt", True)
END IF
call computerlist()
'File Close
f.Close
msgbox "All done"
wscript.quit
SUB computerlist()
CONST key1 =
"\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\CurrentVersion"
SET objReg = WScript.CreateObject("RegObj.Registry")
On Error Resume Next
FOR each comp in DomList=comp.Name
Host = "\\" & List
SET objRemote=objReg.RemoteRegistry(Host)
SET Rootkey=objRemote.RegKeyFromString(key1)
FOR EACH oVal in Rootkey.Subkeys
List=List & "@" oVal.Value
NEXT
f.WriteLine(List)
NEXT
END SUB
__________________________________________________
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/
http://www.sunbelt-software.com/ntsysadmin_list_charter.htm