Okay, so many errors so little time to fix.

I've restructured and re-written most of this script except your HTML sections.
It should run right out the gate now, but won't be what you're looking for.

I'm guessing that when/where/how you're opening/writing/closing the HTML file is not
optimal and is causing improperly coded information.

I've re-written how it get's disk space but I'm not 100% sure of how you're wanting it displayed.

So you can take it from here, or maybe if you're lucky Jooel will help out on it as he seems to
like doing the HTML type code as well.
Then fix that portion and it should actually be a nice little snippet of code.

If you can't get it going or if no one else will help I'll try to get it working, just so
I can run it myself once in a while.

I might have a scope issue there as well, just don't have time to decipher the whole script to that level right now.



Break On
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('NoMacrosInStrings','On')

Global $ServerList, $strComputer, $Servers
Dim $WMI, $objWMIService, $Disk, $DiskSet
Global $dname
Global $Free, $Free0, $Free1, $Free2
Dim $IE
$ServerList = @ScriptDir + '\' + 'servers.txt'
Shell '%COMSPEC% /c netview.exe /NTS /BDC /PDC /b > ' + $ServerList
If @ERROR
"Netview is not found !" ??
"You have to download netview at (http://www.optimumx.com/download/#NetView)" ?
"and place it in this script directory." ?
Quit @ERROR
EndIf
debhtml()
$Servers = ReadFile($ServerList)
For Each $strComputer In $Servers
$strComputer = SubStr($strComputer,3,InStr($strComputer,' ')-3)
If $strComputer<>""
"In progress for " + $strComputer + " ..." ?
$WMI = WMIConfirm($strComputer)
If $WMI > 0
$objWMIService = GetObject("winmgmts:\\"+$strComputer+"\root\cimv2")
breakl()
$DiskSet = $objWMIService.ExecQuery("select * from Win32_LogicalDisk where DriveType=3")
For Each $Disk In $DiskSet
$dname = $Disk.Name
$Free0 = "" $Free1 = "" $Free2 = ""
$Free = GetDiskFreeSpace($strComputer,$dname)
$Free0 = $Free[0]
$Free1 = $Free[1]
$Free2 = $Free[2]
html($strComputer,$dname,$Free1,$Free0,$Free2)
Next
ftabl()
Else
'Unable to access ' + $strComputer + ' due to WMI error' ?
breakl()
offline($strcomputer)
ftabl()
EndIf
EndIf
Next
finhtml()
$IE = CreateObject("InternetExplorer.Application")
$IE.Navigate(@SCRIPTDIR+"\resserv.html")
$IE.Visible = 1
QUIT 1

Function WMIConfirm(optional $sComputer)
Dim $objWMIService, $objWMISetting, $colWMISettings
$sComputer = IIf(Not $sComputer,'','\\'+Join(Split($sComputer,'\'),'',3)+'\')
$objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!"+$sComputer+'root\cimv2')
; Failed - return 0 and exit with error value
If @ERROR
$WMIConfirm = 0
Exit Val('&' + Right(DecToHex(@ERROR), 4))
EndIf
$colWMISettings = $objWMIService.ExecQuery("Select * from Win32_WMISetting")
For Each $objWMISetting In $colWMISettings
$WMIConfirm = $objWMISetting.BuildVersion
Next
Exit 0
EndFunction

Function ReadFile($file)
Dim $lf, $f, $_, $t
$lf=CHR(10)
$f=FreeFileHandle
$_=Open($f,$file)
If @ERROR Exit @ERROR EndIf
Do $t=$t+$lf+ReadLine($f) Until @ERROR
$_=Close($f)
$ReadFile=Split(SubStr($t,2),$lf)
EndFunction

Function debhtml()
Dim $Handle, $Open, $Data, $Close
If Exist(".\resserv.html")
Del ".\resserv.html"
EndIf
$Handle = FreeFileHandle()
If $Handle > 0
$Open = Open($Handle,".\resserv.html",5)
$Data = "<html>"+@CRLF
$Data = $Data + "<head>"+@CRLF
$Data = $Data + "<STYLE>"+@CRLF
$Data = $Data + "BODY {"+@CRLF
$Data = $Data + " font-size:10 pt;"+@CRLF
$Data = $Data + " font-family: Verdana;"+@CRLF
$Data = $Data + "}"+@CRLF
$Data = $Data + "H3 {"+@CRLF
$Data = $Data + " font-size:12 pt;"+@CRLF
$Data = $Data + " font-family: Verdana;"+@CRLF
$Data = $Data + "}"+@CRLF
$Data = $Data + "TH {"+@CRLF
$Data = $Data + " font-family : Verdana;"+@CRLF
$Data = $Data + " font-size : 12;"+@CRLF
$Data = $Data + "}"+@CRLF
$Data = $Data + "TD {"+@CRLF
$Data = $Data + " font-family : Verdana;"+@CRLF
$Data = $Data + " font-size : 12;"+@CRLF
$Data = $Data + "}"+@CRLF
$Data = $Data + "</STYLE>"+@CRLF
$Data = $Data + "</head>"+@CRLF
$Data = $Data + "<body>"+@CRLF
$Data = $Data + "<br>"+@CRLF
$Data = $Data + "<H3>Disk space usage for servers on domain "+@DOMAIN+"</H3>"+@CRLF
$Data = $Data + ""+@CRLF
$Data = $Data + "Unfortunately the non Windows servers could not be queried<br>"+@CRLF
$Data = $Data + "and be reported on 'No WMI or server offline' : (<br><br></font>"+@CRLF
$Data = $Data + "<Table border=0>"+@CRLF
$Data = $Data + "<TR>"+@CRLF
$Data = $Data + "<TD width=120>Server</TD>"+@CRLF
$Data = $Data + "<TD width=100>Used</TD>"+@CRLF
$Data = $Data + "<TD width=100 bgcolor=gray> </TD>"+@CRLF
$Data = $Data + "<TD width=120>Avail-Space</TD>"+@CRLF
$Data = $Data + "</TR>"+@CRLF
$Data = WriteLine($Handle, $Data)
$Close = Close($Handle)
EndIf
EndFunction

Function html($server,$drive,$Free1,$Free0,$Free2)
Dim $Handle, $Open, $Data, $Close
$Handle = FreeFileHandle()
If $Handle > 0
$Open = Open($Handle,".\resserv.html",5)
$Data = "<Table border=0>"+@CRLF
$Data = $Data + "<TR>"+@CRLF
$Data = $Data + '<TD width=120>'+$server+':</TD>'+@CRLF
$Data = $Data + '<TD width=100>Drive '+$drive+' '+$free1+' %</TD>'+@CRLF
$Data = $Data + "<TD width="+$free0+" bgcolor=red> </TD>"+@CRLF
$Data = $Data + "<TD width="+$Free2+" bgcolor=green></TD>"+@CRLF
$Data = $Data + '<TD width=120>'+$Free1+'</TD>'+@CRLF
$Data = $Data + "<TR>"+@CRLF
$Data = WriteLine($Handle, $Data)
$Close = Close($Handle)
EndIf
EndFunction

Function offline($server)
Dim $Handle, $Open, $Data, $Close
$Handle = FreeFileHandle()
If $Handle > 0
$Open = Open($Handle,".\resserv.html",5)
$Data = "<Table border=0>"+@CRLF
$Data = $Data + "<TR>"+@CRLF
$Data = $Data + "<TD width=120>"+$server+":</TD>"+@CRLF
$Data = $Data + "<TD width=200>No WMI or server offline</font></TD>"+@CRLF
$Data = WriteLine($Handle, $Data)
$Close = Close($Handle)
EndIf
EndFunction

;*******
Function breakl()
Dim $Handle, $Open, $Data, $Close
$Handle = FreeFileHandle()
If $Handle > 0
$Open = Open($Handle,".\resserv.html",5)
$Data = WriteLine($Handle,'<hr width="100%" size="1" Color="#FFFFFF">'+@CRLF)
$Close = Close($Handle)
EndIf
EndFunction
;*************************************************
Function ftabl()
Dim $Handle, $Open, $Data, $Close
$Handle = FreeFileHandle()
If $Handle > 0
$Open = Open($Handle,".\resserv.html",5)
$Data = "</TR>"+@CRLF
$Data = $Data + "</Table>"+@CRLF
$Data = WriteLine($Handle, $Data)
$Close = Close($Handle)
EndIf
EndFunction
;*************************************************
Function finhtml()
Dim $Handle, $Open, $Data, $Close
$Handle = FreeFileHandle()
If $Handle > 0
$Open = Open($Handle,".\resserv.html",5)
$Data = '<hr width="100%" size="1" Color="#FFFFFF">'+@CRLF
$Data = $Data + "<br>"+@CRLF
$Data = $Data + "<br>"+@CRLF
$Data = $Data + "Edition: " + @DATE + " - at " + @TIME+" by "+@FULLNAME+@CRLF
$Data = $Data + "</body>"+@CRLF
$Data = $Data + "</html>"+@CRLF
$Data = WriteLine($Handle, $Data)
$Close = Close($Handle)
EndIf
EndFunction

Function GetDiskFreeSpace($sComputer,$Drive)
Dim $objWMIService, $colDisks, $objDisk
Dim $intFreeSpace, $intTotalSpace, $pctFreeSpace, $intUsed
$objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" + $sComputer + "\root\cimv2")
$colDisks = $objWMIService.ExecQuery('Select * from Win32_LogicalDisk Where DeviceID = '+"'"+$Drive+"'")
For Each $objDisk in $colDisks
$intFreeSpace = CDBL($objDisk.FreeSpace)
$intTotalSpace = CDBL($objDisk.Size)
$pctFreeSpace = FormatNumber(($intFreeSpace / $intTotalSpace * 100),2)
$intFreeSpace = FormatNumber($intFreeSpace,0,,-2)
$intUsed = CDBL(100) - $pctFreeSpace
Next
$GetDiskFreeSpace = $pctFreeSpace, $intUsed, $intFreeSpace
Exit @ERROR
EndFunction