This is what I have so far, this will be used to go out to several computers to get the response back and input to the outputfile.
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
'Reads the hostnames file
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("c:\temp\Host.txt", "1")
Set objFile = objFSO.OpenTextFile("c:\temp\outputfile.txt", 2)
Do Until ObjTextFile.AtEndOfStream
strHostName = objTextFile.ReadLine
If InStr(strHostName,",") Then
strHostName = left(strHostName,instr(strHostName,",")-1)
End If
on error resume Next
'Change attribute to read
'Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile1 = objFSO.GetFile("\\" & strHostName & "\c$\windows\system32\oeminfo.ini")
If objFile1.Attributes = objFile1.Attributes AND 1 Then
objFile1.Attributes = objFile1.Attributes XOR 1
End If
'Read the OEMINFO.INI file
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile2 = objFSO.OpenTextFile("\\" & strHostName & "\c$\windows\system32\oeminfo.ini", ForReading)
objFile2.SkipLine
objFile2.SkipLine
objFile2.SkipLine
objFile2.SkipLine
objFile2.SkipLine
objFile2.SkipLine
objFile2.SkipLine
objFile2.SkipLine
objFile2.SkipLine
objFile2.SkipLine
objFile2.ReadLine
objFile2.close
If Err.Number = 0 Then
objFile.Writeline (strHostName & objFile2.ReadLine)
Else objFile.Writeline (strHostName & " NA")
End If
Loop