A VB Script that checks registry for installed hotfix

转载 2007年10月11日 01:57:00

———————————————————————-

'Checks the registry of each computer listed in INPUT_FILE_NAME
'for a the hotfix listed in HOTFIX
'It uses the WMI registry provider to do this.
'Besides writing to the screen, it writes the output to
'the file in OUTPUT_FILE_NAME in comma delimted format, producing 2 columns:
'the computer name, and the result of the query
'
'21/10/2005 Robert Kloosterhuis: v1.0
'http://www.geekswithblogsnet/jemimus


On Error Resume Next

INPUT_FILE_NAME = "serverlist.txt"
OUTPUT_FILE_NAME = "scan_hotfix_MS05_051.csv"
HOTFIX = "KB902400"

Const FOR_READING = 1
'objFSO.OpenTextFile method uses paramater value 8 to append to file
Const FOR_WRITING = 8
const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002

Set StdOut = WScript.StdOut

'Set up objFSO variable for file reading and writing operations
Set objFSO = CreateObject("Scripting.FileSystemObject")

'delete OUTPUT_FILE_NAME if it already exists
Set oldfile = objFSO.GetFile(OUTPUT_FILE_NAME)
oldfile.delete

'Set up the output file
Set objOutputFile = objFSO.OpenTextFile(OUTPUT_FILE_NAME, FOR_WRITING, true)


'Read the input file
Set objFile = objFSO.OpenTextFile(INPUT_FILE_NAME, FOR_READING)
strComputers = objFile.ReadAll
objFile.Close

'Make an array out of the list it reads from the input file
arrComputers = Split(strComputers, vbCrLf)

'setting up some initial values
DIM result
DIM noresult
result = 0
noresult = 0

'Our main loop. Everything below this is run for every entry in the imput file
For Each strComputer In arrComputers

  'first column in the file we are writing to is the computer name.
  'Every bit of info we want to provide is ended with a comma for delimitation
   objOutputFile.Write
   objOutputFile.Write
   objOutputFile.Write strComputer
   objOutputFile.Write ","
  
  
  Err.Clear
  'Connect to the WMI registry provider
  Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!//" & _
     strComputer & "/root/default:StdRegProv")
        'Error Handling If it cant connect to the WMI provider,
        'exit with the Error Description
     If Err.Number <> 0 Then
           Wscript.Echo strComputer & " " & "Error Number " & _
           Err.Number &  ": " & Err.Description
           Err.Clear
           Else
  
          'The Registry path we are going to read from
    strKeyPath = "SOFTWARE/Microsoft/Windows NT/CurrentVersion/HotFix"
    objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

    
    'Everytime we run though the loop, these values are reset first.
    result = 0
    noresult = 0
    
    'If it comes across the hotfix we are looking for,
    'it changed the value for this loop
    For Each Subkey in arrSubKeys
                   
        IF Subkey = HOTFIX Then
        result = 1
        noresult = 0
       
        Else
        noresult = 1
       
     End IF           
              
    Next          
          
    
     'Now we have a value, lets print some text about it,
     'both to the screen, and to our output file
     IF result = 1 Then
       
       WScript.Echo strComputer & " " & HOTFIX & " installed!!!"
       objOutputFile.Write HOTFIX & " installed!!!"
     Else
       WScript.Echo strComputer & " " & HOTFIX & " not found!"
       objOutputFile.Write HOTFIX & " not found!"
     End IF

     
        'End with a comma for this column
        objOutputFile.Write ","
        
        
       
      
        

     end if
     
     'Start a new line  
     objOutputFile.Writeline
     
Next
objOutputFile.Close 

Eclipse中jsp页面中js脚本报错this inspection checks that the script tag content is valid XML.

首先,js代码没有错误,在里面使用了el表达式,但是编辑器总是提示this inspection checks that the script tag content is valid XML,解决办...
  • Lemostic
  • Lemostic
  • 2018-01-30 15:29:28
  • 375

Hotfix KB2731284 or later update is installed, no need to zero-out data files

Solution : Steps to download and install Hotfix KB2731284 for MongoDB Step 1: Search for the missin...
  • u013068377
  • u013068377
  • 2016-12-19 19:08:43
  • 2258

mongodb启动服务失败:Hotfix KB2731284 or later update is installed, no need to zero-out data files

问题描述:mongodb安装成功后,执行mongod.exe --dbpath d:\mongdb\data后,浏览器输入(localhost:27017)不能访问解决:查看执行命令后的窗口,可以发现...
  • zhao3132453
  • zhao3132453
  • 2018-02-24 11:53:44
  • 115

OCP-1Z0-053-V12.02-492题

492.You installed Oracle Database 11g and are performing a manual upgrade of the Oracle9i database. ...
  • rlhua
  • rlhua
  • 2013-11-06 00:05:44
  • 4686

subprocess installed post-installation script returned error exit status 1

如果 apt-get 出現 “subprocess installed post-installation script returned error exit status 1″ 的錯誤 dpkg...
  • zxd675816777
  • zxd675816777
  • 2014-09-07 14:39:39
  • 3308

Ubntu 14.04 LTS 下编译安装R Source Code

在Ubuntu 14.04 LTS 发布后,立刻重装. 作为一名伪统计学爱好者,不得不装R软件... 于是ctrl +alt+T 打开终端,输入  sudo apt-get install R...
  • lzz360
  • lzz360
  • 2015-07-23 10:58:37
  • 997

This inspection checks references to files and directories

使用WebStorm编写CSS文件出现如下问题: li.vip a{   padding-left:30px;   background:url(Images/vip.jpg) no-repea...
  • The_Rolling_Kid
  • The_Rolling_Kid
  • 2017-04-27 21:54:00
  • 1107

安装MongoDB遇到问题

1. 首先,当然是下载 MongoDB MongoDB的官方网站是:http://www.mongodb.org/, 最新版本下载在:http://www.mongodb.org/down...
  • gebitan505
  • gebitan505
  • 2015-08-28 14:53:44
  • 17250

no python installation found in the registry

今天在win7 x64系统下安装robotframework时,出现“no python installation found in the registry”这个错误。 原因:python是32位...
  • liuheng123456
  • liuheng123456
  • 2013-01-15 11:29:46
  • 6702

向每一个错误致敬——Android HotFix

Android HotFix —— AndFix使用说明项目以飞快的速度迭代,2周进行一次迭代升级。每次开发完功能跑通,在现有机型上测试没问题的话,就提交市场。在以极快的速度迭代的时候,避免不了出现各...
  • watermusicyes
  • watermusicyes
  • 2016-01-16 19:58:15
  • 7297
收藏助手
不良信息举报
您举报文章:A VB Script that checks registry for installed hotfix
举报原因:
原因补充:

(最多只允许输入30个字)