scripting@wanadoo.nl




slQueryHotFix()

http://www.scriptlogic.com/kixtart/FunctionLibrary_FunctionList.aspx


actual FunctionLibrary list on 'Scriptlogic' site printer-friendly mirror of UDF topic on 'scripting@wanadoo.nl' site close
9 May 2003 slQueryHotFix()
AuthorScriptLogic Corporation
Action Queries whether a specific hotfix is installed -or- returns a string of all the hotfixes that are installed.
SyntaxslQueryHotFix ([HotFix]) 
Parameters
  • HotFix (Optional / String) Name of the hotfix to test for. 
  • RemarksThis function is only supported on the NT-family of products (NT4/2000/XP/etc.)

    The hotfix parameter can optionally contain the name of a remote computer in the form of "\\computer\hotfix"

    You may notice a second optional parameter in the source code. This is for backward compatibility with the previous version of this UDF that was published as QueryHotFix()
    ReturnsIf a specific hotfix name was supplied, a 0 will be returned if the hotfix is not installed, or a 1 will be returned if the hotfix is installed.
    If no hotfix name was supplied, a string of all installed hotfixes will be returned (each separated by a space). 
    Examples
    ; example 1
    ?'List of all hot fixes installed on this computer:'
    $HFarray=split(QueryHotFix()
    for each $element in $HFarray
      ? $element
    next
    
    ; example 2
    ?'List of all hot fixes installed on a different computer'
    $HFarray=split(QueryHotFix('\\Computer2')
    for each $element in $HFarray
      ? $element
    next
    
    ; example 3
    :loop1
    ?'Test for a specific hot-fix'
    ?'Enter computer name (EXIT to terminate):'
    gets $cname
    if $cname='EXIT'
      quit 0
    endif
    if not $cname
      $cname=@WKSTA
    endif
    ?'Enter HotFix name:'
    gets $hfname
    $result=QueryHotFix('\\'+$cname+'\'+$hfname)
    if $result
      ? $HFname+' is installed on '+$cname
    else
      ? $HFname+' is NOT installed on '+$cname
    endif
    goto loop1
    
     
    Source
    FUNCTION slQueryHotFix (OPTIONAL $hotfix, OPTIONAL $bcp)
      ; Last revised: 2002-Jul-25
      ; Developed by ScriptLogic Corp. / www.scriptlogic.com
      ; Parameter: $HotFix (optional)
      ; If parameter is omitted, a string of all installed hotfixes is returned.
      ; Alternatively, Parameter can be the name of a specific hotfix to test for:
      ;   If the hotfix is installed, this function returns a numeric 1.
      ;   If the hotfix is not installed, this function returns a numeric 0.
      ; This function is only supported on the NT-family of products (NT4/2000/XP/etc.)
      ; Examples for $HotFix parameter:
      ; \\computer\hotfix
      ; \\computer
      ; hotfix
      ; 
      DIM $key, $hf, $index, $tmparray, $tmpstr, $computer
      $slqueryhotfix=''
      IF @inwin=1
        IF $bcp
          ; Older version of this UDF used two arguments (computer,hotfix)
          ; This arguments provides backwards compatability
          ; in older version of UDF, the computer argument could have been
          ;  supplied with or without leading bashes.
          IF Left($hotfix,2)='\\'
            $hotfix=Substr($hotfix,3)
          ENDIF
          $hotfix='\\'+$hotfix+'\'+$bcp
        ENDIF
        IF Left($hotfix,2)='\\' ; we've been given a computer's name
          $tmpstr=Substr($hotfix,3)
          $tmparray=Split($tmpstr+'\','\',2)
          $computer=$tmparray[0]
          $hotfix=''+$tmparray[1]
        ELSE
          $computer=@wksta
        ENDIF
        $key='\\'+$computer+'\HKLM\Software\Microsoft\Windows NT\CurrentVersion\Hotfix'
        IF ''+$hotfix='' ; no parameter supplied. Enum all and return as a string.
          $index=0
    :hfloop
          $hf=EnumKey($key,$index)
          IF @error=0
            IF $hf<>'ServicePackUninstall' ; WTFWMST?
              $slqueryhotfix=$slqueryhotfix+' '+$hf
            ENDIF
            $index=$index+1
            GOTO hfloop
          ENDIF
          $slqueryhotfix=Substr($slqueryhotfix,2)
        ELSE 
          ; check if a specific hotfix is installed
          IF InStr('0123456789',Left($hotfix,1))
            ; if it starts with a number, prepend a Q
            $hotfix='Q'+$hotfix
          ENDIF
          $slqueryhotfix=KeyExist($key+'\'+$hotfix)
        ENDIF
      ENDIF
    ENDFUNCTION ; - slQueryHotFix -
     
      original source of UDF topic. show actual FunctionLibrary list on Scriptlogic site close top
              printer-friendly mirror of UDF topic on scripting@wanadoo.nl site  




    Copyright © 2003 www.scriptlogic.com & scripting@wanadoo.nl - last updated on 20 May 2003


    Site Meter