I use this script to output the information to the screen. Shouldn't be to hard to modify to write to a file.
Dim args, i
If Right(UCase(WScript.FullName),11)= "WSCRIPT.EXE" Then
args=""
For i=0 to WScript.Arguments.Count-1
args = args & WScript.Arguments(i) & " "
Next
Set WshShell=WScript.CreateObject("WScript.Shell"

WshShell.Run WshShell.ExpandEnvironmentStrings("%comspec%"

& _
" /C cscript.exe """ & WScript.ScriptFullName & """" & args
Set WshShell = Nothing
WScript.Quit
End If
set wshshell = CreateObject("WScript.Shell"

set fs = CreateObject("Scripting.FileSystemObject"
DIM BRARRAY(0)
BRARRAY(0) = "firstthreeoctetsofip(ie xxx.xxx.xxx.)"
startoct = 1
endoct = 10
i = startoct
z = 0
on Error Resume Next
DO UNTIL Z = 1
STRCOMPUTER1 = Left(brarray(z),11)
hostname = strcomputer1 & startoct
do until i = endoct
if not reachable(hostname) then
wscript.echo iplit & hostname & " : " & " unused" & vbcr
else
cname hostname,compname
wscript.echo iplit & hostname & " : " & COMPNAME & vbcr
end if
i = i + 1
hostname = strcomputer1 & i
loop
z = z + 1
loop
wscript.quit
'*************************************************************
'*** Is Server Available Function ***
'*************************************************************
function Reachable(Hostname)
Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell"
'The tool is launched
Set oExec = WshShell.EXEC("ping -n 2 -w 500 " & hostname)
'wait for the end of process
Do While oExec.Status = 0
WScript.Sleep 100
Loop
'scan and display the command output flow
Do While oExec.StdOut.AtEndOfStream <> True
retstring = oExec.StdOut.ReadLine
if instr(retString, "Reply"

>0 then
reachable = true
exit do
end if
Loop
end function
sub cname(hostname,compname)
Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell"
'The tool is launched
Set oExec = WshShell.Exec("nbtstat -A " & hostname)
'wait for the end of process
Do While oExec.Status = 0
WScript.Sleep 100
Loop
'scan and display the command output flow
Do While oExec.StdOut.AtEndOfStream <> True
retstring = oExec.StdOut.ReadLine
if instr(retString, "UNIQUE"

>0 then
COMPNAME = MID(RETSTRING,5,7)
exit do
end if
Loop
end sub