Input File for Script

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I have found the below script online (Thanks Alex and Torgeir) that does
everything I need to do when searching for members of the local
administrators group. I would like to know if someone can tell me how to use
an input file to populate the aComputers field. I have a file
(computers.txt) that has all of the computers listed that I would like to
search. How can I make this script use this standard text file to input the
array of computers?

' some array with computers
aComputers = Array("computer1", "computer2")


For Each sComputer In aComputers
' check if computer is online
If IsConnectible(sComputer, 1, 750) Then


' suppress errors
On Error Resume Next


' group name to list users from
Set oGroupAdm = GetObject("WinNT://" & sComputer & "/Administrators")
If Err.Number = 0 Then
WScript.Echo "Administator members of computer: " & sComputer & vbCrLf
' loop through all member of the group
For Each oAdmGrpUser In oGroupAdm.Members
' get the name
sAdmGrpUser = oAdmGrpUser.Name
' no point in listing Administrator
' use lowercase letters in the names in the If test!
If LCase(sAdmGrpUser) <> "administrator" Then
WScript.Echo sAdmGrpUser
End If
Next
Else
WScript.Echo "Could not connect to computer: " & sComputer
End If
Else
WScript.Echo sComputer & " is not online"
End If
Err.Clear
Next
On Error Goto 0


Function IsConnectible(sHost, iPings, iTO)
' Returns True or False based on the output from ping.exe
'
' Author: Alex Angelopoulos/Torgeir Bakken
' Works an "all" WSH versions
' sHost is a hostname or IP


' iPings is number of ping attempts
' iTO is timeout in milliseconds
' if values are set to "", then defaults below used


If iPings = "" Then iPings = 2
If iTO = "" Then iTO = 750


Const OpenAsDefault = -2
Const FailIfNotExist = 0
Const ForReading = 1


Set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
sTemp = oShell.ExpandEnvironmentStrings("%TEMP%")
sTempFile = sTemp & "\runresult.tmp"


oShell.Run "%comspec% /c ping -n " & iPings & " -w " & iTO _
& " " & sHost & ">" & sTempFile, 0 , True


Set fFile = oFSO.OpenTextFile(sTempFile, ForReading, _
FailIfNotExist, OpenAsDefault)


sResults = fFile.ReadAll
fFile.Close
oFSO.DeleteFile(sTempFile)


Select Case InStr(sResults,"TTL=")
Case 0 IsConnectible = False
Case Else IsConnectible = True
End Select
End Function



.



Relevant Pages

  • Re: Input File for Script
    ... > everything I need to do when searching for members of the local ... > (computers.txt) that has all of the computers listed that I would like to ...
    (microsoft.public.windows.server.scripting)
  • Re: NYS mandates "large print" for utility bills [Telecom]
    ... automated text to voice translation of the online bills.. ... I don't dispute those benefits (though how many computers have ... center be available at the time the senior wants to use it? ...
    (comp.dcom.telecom)
  • Re: Legal Surname Changes
    ... If the person or their family was either rich, ... newspapers, and the local newspaper. ... now it is indexed online. ... Also worth searching on your favourite family names for notices, ...
    (soc.genealogy.britain)
  • Online Daters Sue Matchmaking Sites For Fraud
    ... & Gignac LLP, which brought the suit. ... Match "promotes the policies of integrity to protect members, ... Yahoo spokeswoman Rochelle Adams said the company had no comment on ... online dating industry has slowed, ...
    (comp.dcom.telecom)
  • Re: Shared Workspace document doesnt show the status of on line m
    ... I have the same issue and think I have worked out why members appear not to ... area created from any template other than inheriting form the parent template ... then online collaboration will not work. ... workspace area that shows Online and Not Online members status. ...
    (microsoft.public.sharepoint.portalserver)