function WriteExcel()
dim $xl, $Name
$header = "Server","Ip-Address","Distribution State","Installation State"
$xl = createobject("excel.application")
if not @error
$ = $xl.Workbooks.Add
$xl.Range("A1:D1").Value = $header
$xl.Range("A1:D1").Font.Bold = 1
$xl.Range("A1:D1").Orientation = 90
$ = $xl.Range("A1:D1").AutoFilter
for $i = 0 to ubound($srv)
$xl.Range("A"+($i+2)+":D"+($i+2)+"").Value = $srv[$i]
if $srv[$i][4] <> '-'
$comment = $xl.Range("C"+($i+2)).AddComment($srv[$i][4])
$comment.shape.textframe.autosize = 1
endif
if $srv[$i][5] <> '-'
$comment = $xl.Range("D"+($i+2)).AddComment($srv[$i][5])
$comment.shape.textframe.autosize = 1
endif
next
$xl.Range("A1:B1").Cells.ColumnWidth = 15
$xl.Range("C1:D1").Cells.ColumnWidth = 8
$xl.Range("A1:D1").EntireColumn.HorizontalAlignment = 3
$xl.Range("B2:B300").HorizontalAlignment = 1
$xl.ActiveSheet.Name = "Deploy SP4 Status"
$ = $xl.Range("A2").Activate
$xl.ActiveWindow.FreezePanes = 1
$ = $xl.ActiveWorkbook.SaveAs("$Log")
$xl.UserControl = 1
$bye = $xl.quit
else
exit(0)
endif
$WriteExcel = 1
endfunction