OK.. I am feeling a little lame here.. It seems that vars for computer name for WSHPING, WMIQUERY do not pass through right. What am I doing wrong?

Trying to run the following:
Code:

cls
break on
DIM $oxl,$Row,$b,$ip,$make,$model,$sn,$cs,$mm,$mt,$,$u
$rc=SETOPTION('Explicit','On')
$rc=SETOPTION('NoVarsInStrings','On')

$oXL=Createobject('Excel.application')
;Check to insure that Excel is available
IF 0<>@error ?@error ' Excel Application is not found'
SLEEP 4
RETURN
ENDIF
$Rc=$oXL.workbooks.open(@scriptdir+'\Altiris.xls')
$Row=1 ;Row to start at using column headings, change to 0, if needed
WHILE $oXL.cells($Row,1).value<>'' ;need a value each time in column 1
$Row=$Row+1
IF $oXL.cells($Row,1).value='' ;Once it gets to a blank row...
$oXL.quit ;quit Excel
$oXL=0 ;set the object to 0
ELSE
$b=$oXL.cells($Row,1)
$ip=WSHPing($b)
$u=WMIQuery("username","Win32_ComputerSystem",$b)
;$ip=WSHPing('"'+$b+'"')[0]
$make=WMIQuery("Manufacturer","Win32_ComputerSystem",$b)
;$make = WMIQuery("Manufacturer","Win32_ComputerSystem",'$b')[0]
;$model=WMIQuery("Model","Win32_ComputerSystem",'$b')[0]
;$sn=WMIQuery("SerialNumber","Win32_BIOS",'$b')[0]
;$cs=WMIQuery("CurrentClockSpeed","Win32_Processor",'$b')[0]
;$mm=WMIQuery("MonitorManufacturer","Win32_DesktopMonitor",'$b')[0]
;$mt=WMIQuery("MonitorType","Win32_DesktopMonitor",'$b')[0]
?$b
?$ip[0]
?$u[0]
?$make

;IF LEFT($ip,5)='10.55'
;?$b+','+$ip
;ENDIF
ENDIF
LOOP
?'process is complete'
get $

FUNCTION WSHPing($Computer,optional $replies)
dim $ip, $l, $r, $count, $return, $line ,$pos, $avg,$shell
if not $replies $replies=1 endif
$ip=$computer $Count=0
$shell='%comspec% /c %windir%\system32\ping $Computer -n $replies '
$return=WSHPipe($shell,1)
if not @error
for each $line in $return
select
case instr($line,"[") $l=instr($line,"[")+1
$r=instr($line,"]")
$ip=substr($line,$l,$r-$l)
case instr($line,"reply from") $Count=$Count+1
case instr($line,"Average") $pos=instr($line,"Average")+8
$avg=val(right("$line",len($line)-$pos))
endselect
if instr($line,"timed out") $Count=$Count-1 endif
next
$WSHPing=$ip,$count,$avg
else
$WSHPing="0.0.0.0","0","0"
exit(487)
endif
ENDFUNCTION

Function WshPipe($ShellCMD, OPTIONAL $NoEcho)
Dim $WshShell, $oExec, $AllOutput, $Exit, $WshExitCode,$WshErrorMsg
$WshErrorMsg=""
$WshShell=CreateObject("WScript.Shell")
$oExec=$WshShell.Exec($ShellCMD)
While $Exit<>1
Dim $Output
Select
Case Not $oExec.StdOut.AtEndOfStream $Output=$oExec.StdOut.ReadAll
Case Not $oExec.StdErr.AtEndOfStream $Output=$oExec.StdErr.ReadAll
$WshErrorMsg = $Output
Case 1 $Output=-1
EndSelect
If $Output=-1
If $oExec.Status=1 $Exit=1 Endif
Else
If $NoEcho<>1 ? $Output Endif
$AllOutput = $AllOutput + $Output
Endif
Loop
$WshExitCode=$oExec.ExitCode
$WshPipe=split($AllOutput,chr(10))
Exit($WshExitCode)
EndFunction

;Function LOGGER($logfil,$logdat)
;
;Author Kent Dyer (leptonator@hotmail.com)
;
;Contributors MBrecht on CramSession.com
; http://infocenter.cramsession.com/TechLibrary/GetHtml.asp?ID=721&GetDes=&CatID=293
; "Create Loginlog"
; Jooel (Lonkero) - Code cleanup
; Howard Bullock
;
;Action Writes to a Server Log
;
;Syntax LOGGER($logfile,$logdata)
;
;Version 1.2 - Recommendation by Howard Bullock
; 1.1 - Clean-up by Lonkero
;
;Parameters $logfile - Specify what server, share, and file is needed
; $logdata - Data to be written to the log
;
;Remarks This script addresses an issue with writing to logs if the file is open by
; another user it waits until they are done and has the log file closed.
; It does a 1 second wait until ready to write to the log till a maximum of 6 seconds and then exits the routine.
; The 5x3 wait routine is not used anymore.
;
;Returns Writes to a file. No visible user output.
;
;Dependencies All Domain Users being able to write to a server share
;
;KiXtart Ver 4.02
;
;Example(s) ; -- Data
; $logshare='\\SERVER\LOGINFO'
; $logfile=$logshare+'\HOTBAR.TXT'
; $logdata=@date + ',' + @time + ',' + @userid + ',WinNT,' + @wksta + @CRLF
; ; -- Example
; LOGGER($logfile,$logdata)
;
FUNCTION LOGGER($logfile,$logdata)
DIM $n
WHILE Open(1,$logfile,5)<>0
IF $n
'.'
ELSE
? 'Please wait'
ENDIF
$n=$n+1
IF $n=6
EXIT(1)
ENDIF
SLEEP 1
LOOP
$n=WriteLine(1, $logdata)
$n=Close(1)
ENDFUNCTION

;FUNCTION WMIQuery
;ACTION Queries WMI information from supported systems
;AUTHOR Radimus
;CONTRIBUTORS kdyer, Shawn, And Howard
;VERSION 2.4
;DATE CREATED 12/22/2001
;DATE MODIFIED 09/23/2003
;KIXTART 4.x
;SYNTAX WMIQuery($what,$from,optional $computer,optional $where, optional $x)
;
;PARAMETERS $what
;
;
; $from
; Win32 Collection
;
; optional $computer
; defaults to local PC
;
; optional $where
; addl parameter for a 'WHERE' clause. Used with $x
;
; optional $x
; addl parameter for a 'WHERE' clause. Used with $Where
;
;
;RETURNS Array
; @error 1 = Cannot create COM object on target PC
;
;REMARKS This is chage alters the return from the function into an ARRAY, where the previous version
; was a pipe '|' delimited string. If you are updating to this version, check your code closely
;
;DEPENDENCIES kix 4.x+, WMI
;
;EXAMPLE $make = WMIQuery("Manufacturer","Win32_ComputerSystem")[0]
; $modem = WMIQuery("Description","Win32_POTSModem",$remotePC,"Status","OK")[0]
; for each $stick in WMIQuery("Capacity","Win32_PhysicalMemory")
; ? val($stick) / 1048576
; next
;
;KIXTART BBS http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=12;t=000117
; http://download.microsoft.com/download/platformsdk/wmicore/1.5/W9XNT4/EN-US/wmicore.EXE

FUNCTION WMIQuery($sWhat, $sFrom, Optional $sComputer, Optional $sWhere, Optional $x, Optional $root)
Dim $sQuery, $objEnum, $sValue, $sItem, $TMP, $SystemSet, $, $objInstance
If Not $sComputer $sComputer="." EndIf
if instr($sComputer,'\') $sComputer=right($sComputer,instrrev($sComputer,'\')) Endif
if not $root $root="\root\cimv2" Endif
$sQuery = "Select " + $sWhat + " From "+ $sFrom
If $sWhere AND $x $sQuery = $sQuery+" Where "+$sWhere+" = '"+$x+"'" EndIf
$SystemSet = GetObject("winmgmts:{impersonationLevel=impersonate}!\\"+$sComputer+$root)
If @ERROR Exit VAL("&"+Right(DecToHex(@ERROR),4)) EndIf
$objEnum = $SystemSet.ExecQuery($sQuery)
If @ERROR Exit VAL("&"+Right(DecToHex(@ERROR),4)) EndIf
For Each $objInstance in $objEnum
If $objInstance
$=Execute("$"+"sValue = $"+"objInstance."+$sWhat)
if VarType($sValue) & 8192
For Each $sItem in $sValue $tmp=$tmp+'|'+Trim($sItem) Next
else
$tmp=$tmp+'|'+Trim($svalue)
Endif
EndIf
Next
$WMIQuery = split(substr($tmp,2),'|')
Exit VAL("&"+Right(DecToHex(@ERROR),4))
ENDFUNCTION



Thanks!

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's