Sorry. It been busy at work. fnWMIConnect is from the UDF library. I don't think I hacked it much. If I missed something please yell.

fnWMIConnect


FUNCTION fnWMIConnect(OPTIONAL $sComputerOPTIONAL $sUSEROPTIONAL $spwdOPTIONAL $ImpLevelOPTIONAL $authLevelOPTIONAL $sNamespace)
;-- This will make a WMI connection to a namespace on a computer.
;ImpersonationLevels:
;--- Anonymous:        Hides the credentials of the caller. Calls to WMI may fail with this impersonation level.
;--- IdentIFy:        Allows objects to query the credentials of the caller. Calls to WMI may fail with this impersonation  level.
;--- Impersonate:    Default.  Allows objects to USE the credentials of the caller. This is the recommended impersonation level
;---                for WMI Scripting API calls.
;--- Delegate:        Allows objects to permit other objects to USE the credentials of the caller. This impersonation, which&nb sp;will
;---                work with WMI Scripting API calls but may constitute an unnecessary security risk, is supported only  ;under Windows 2000.
    DIM $locator$context$namespace$moniker
    SELECT
        CASE $ImpLevel=1
            $ImpLevel = "Anonymous"
        CASE $ImpLevel=2
            $ImpLevel = "IdentIFy"
        CASE $ImpLevel=3
            $ImpLevel = "impersonate"
        CASE $ImpLevel=4
            $ImpLevel = "Delegate"
        CASE 1
            $ImpLevel = "impersonate"
    ENDSELECT
    $authLevel = "pktPrivacy"
    $moniker = "winmgmts:{impersonationLevel=" + $ImpLevel + ",authenticationLevel=" + $authLevel+"}!\\"
    $namespace = "\root\cimv2"
    IF $sNamespace
        $namespace = $sNamespace
    ENDIF
    IF NOT $sComputer OR $sComputer = "@Wksta" OR $sComputer = "."
; local host
        $sComputer = "@Wksta"
        $fnWMIConnect = GetObject($moniker+$sComputer+$namespace)
    ELSE
; remote host
        IF ($sUSER AND $spwd) OR $sUSER
            IF Substr($namespace11) = "\"
                $namespace = Substr($namespace2Len($namespace) - 1)
            ENDIF
            $locator = CreateObject("WbemScripting.SWbemLocator")
            $context = CreateObject("WbemScripting.SWbemNamedValueSet")
            $fnWMIConnect = $locator.ConnectServer($sComputer,$namespace,$sUSER,$spwd,"","",0,$context)
        ELSE
; current (local) credentials
            $fnWMIConnect = GetObject($moniker+$sComputer+$namespace)
        ENDIF
    ENDIF
    IF @Error
        $fnWMIConnect = @SError
    ENDIF
    EXIT @Error
ENDFUNCTION


fnSMSGetResourceID


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

_________________________
Kelly