my god SMS sucks

it takes almost 30 seconds to do a list 5 computers... and that is after I pulled out the ping routine...

code:
 
BREAK ON
DIM $Computer, $MACAddress

$WMISMSServer = fnWMIConnect("SMSserver",,,,,"/root/sms/site_000")
IF VarType($WMISMSServer) = 9

for each $Computer in split('wheelerc wheelerc-400 wheelerc-510 wheelerc-LAP')
$ResourceID = fnSMSGetResourceID($Computer, $WMISMSServer)
$MACAddress = fnGetMAC($ResourceID)
? $Computer +' '+ $MACAddress
next
ELSE
? "NoAccess"
ENDIF



;================================================================
FUNCTION fnWMIConnect(OPTIONAL $sComputer, OPTIONAL $sUSER, OPTIONAL $spwd, OPTIONAL $ImpLevel, OPTIONAL $authLevel, OPTIONAL $sNamespace)
DIM $locator, $context, $namespace, $moniker
$moniker = "winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktPrivacy}!\\"
$namespace = iif($sNamespace,$sNamespace,"\root\cimv2")
IF NOT $sComputer OR $sComputer = "@Wksta" OR $sComputer = "."
$sComputer = "@Wksta"
$fnWMIConnect = GetObject($moniker+$sComputer+$namespace)
ELSE
IF ($sUSER AND $spwd) OR $sUSER
IF Substr($namespace, 1, 1) = "\"
$namespace = Substr($namespace, 2, Len($namespace) - 1)
ENDIF
$locator = CreateObject("WbemScripting.SWbemLocator")
$context = CreateObject("WbemScripting.SWbemNamedValueSet")
$fnWMIConnect = $locator.ConnectServer($sComputer,$namespace,$sUSER,$spwd,"","",0,$context)
ELSE
$fnWMIConnect = GetObject($moniker+$sComputer+$namespace)
ENDIF
ENDIF
IF @Error
$fnWMIConnect = @SError
ENDIF
EXIT @Error
ENDFUNCTION
;================================================================
FUNCTION fnSMSGetResourceID($ComputerName, $WMISMSServerName)
;--- This function will return the Resource ID for a computer from the SMS Server.
DIM $SMSGetResourceIDError, $SMSGetResourceIDQuery
$SMSGetResourceIDQuery = 'Select ResourceID from SMS_R_System where Name=' + '"' + $ComputerName + '"'
$SMSGetResourceIDObjEnumerator = $WMISMSServerName.ExecQuery($SMSGetResourceIDQuery)
$SMSGetResourceIDError = @Error
IF $SMSGetResourceIDError <> 0
$fnSMSGetResourceID = 0
ELSE
FOR EACH $SMSGetResourceIDObjInstance IN $SMSGetResourceIDObjEnumerator
FOR EACH $SMSGetResourceIDOProp IN $SMSGetResourceIDObjInstance.Properties_
$fnSMSGetResourceID = $SMSGetResourceIDOProp.Value
NEXT
NEXT
ENDIF
$SMSGetResourceIDObjEnumerator = ''
EXIT $SMSGetResourceIDError
ENDFUNCTION
;================================================================
FUNCTION fnGetMAC($ComputerResourceID)
$oClient = $WMISMSServer.ExecQuery ("Select MacAddresses FROM SMS_R_System WHERE ResourceID=" + $ComputerResourceID)
FOR EACH $Client IN $oClient
$Index = 0
FOR EACH $MAC IN $Client.MacAddresses
$fnGetMAC = Join(Split($Client.MacAddresses($Index), ":", -1), "")
$Index = $Index + 1
NEXT
NEXT
ENDFUNCTION

_________________________
How to ask questions the smart way <-----------> Before you ask