Board logo

标题: [绝对好资料]WIM WMIC开发技术资料全收藏(持续更新中......) [打印本页]

作者: HUNRYBECKY     时间: 2006-12-13 02:16    标题: [绝对好资料]WIM WMIC开发技术资料全收藏(持续更新中......)

最近收集了一些WIM WMIC的有关资料,现在贴一些上来,需要的可以顶帖,如果斑竹看的上可以加精!

谢谢,对于WIM和WIMC我不懂,最近听说这个东西很好,可以配合WINDOWS脚本完成绝大多数的系统维护操作,而且到MS网站上的脚本中心看到大量的脚本实例,觉得很有研究价值!

根据楼下的兄弟建议,把所有的都转移到顶贴中便于下载。谢谢该兄弟的建议。

1.《WMI技术指南》:这个是基本上已经绝版的好图书,在网上唯一能找到的是来自“MS技术中国”的扫描版,该书我也是向该论坛斑竹索取的。谢谢技术中国也谢谢CN-DOS。
下载地址:
http://zhenlove.com.cn/cndos/fileup/files/Wmi技术指南(PDF).rar
2.《WMI开发文档》来自MS网站,下载地址是:http://zhenlove.com.cn/cndos/fileup/files/wmisdk(WMI开发文档).rar
3.《WMIC:从命令行对Windows的全面管理》,收集于网站:下载地址:
http://zhenlove.com.cn/cndos/fileup/files/WMIC从命令行对Windows的全面管理.rar
4.一段关于WMI的脚本,该脚本来自MS网站,原内容有点问题,稍微修正了一下.要运行该脚本,请复制代码到记事本中并保存为"search.vbs",注意保存时必须加引号,否则不是脚本文件而是文本文件;然后到CMD下使用命令,格式如下:Search.vbs 类关键字,该脚本可以实现搜索WMI CLASS的是属性等.
;代码开始=============================================
Set args = wscript.arguments
If args.Count <= 0 Then
    Wscript.Echo "Tool to search for a matching class in the WMI Repository. "
    Wscript.Echo "USAGE: <keywordToSearch> [<namespaceToSearchIn>]"
    Wscript.Echo "Example1: Cscript search.vbs service"
    Wscript.Echo "Example2: Cscript search.vbs video root\cimv2"
Else
    ' If no Namespace is specified then the Default is the ROOT namespace
    rootNamespace = "\\.\ROOT"
    keyword = args(0)
    If args.Count > 1 Then
        rootNamespace = args(1)
    End If   
    EnumNameSpace rootNamespace
    Wscript.Echo vbNewLine
End if
  
' Subroutine to recurse through the namespaces

Sub EnumNameSpace(parentNamespaceName)

Set objService = GetObject("winmgmts:" & parentNamespaceName)

Set collMatchingClasses = objService.Execquery _
    ("Select * From meta_class Where __class " & _
    "Like '%" & keyword & "%'")
If (collMatchingClasses.count > 0) Then
    Wscript.Echo vbNewLine
    Wscript.Echo vbNewLine
    Wscript.Echo "Matching Classes Under Namespace: " & parentNamespaceName

    For Each matchingClass in collMatchingClasses
        Wscript.Echo "    " & matchingClass.Path_.CLASS
    Next   
End if

Set collSubNamespaces = objService.Execquery _
    ("select * from __namespace")
For Each subNameSpace in collSubNamespaces
    EnumNameSpace subNameSpace.path_.namespace + _
        "\" + subNameSpace.Name
Next

End Sub
;代码结束======================================================

5.WMI CLASSES有关资料,来源于MS网站,下载地址:http://zhenlove.com.cn/cndos/fileup/files/WMI Classes.rar
关于检查电脑所有脚本版本检测的有关脚本,请把代码保存为version.vbs.双击运行或在CMD下输入 start version.vbs (注意匹配自己的路径)
;代码开始===============================================
On Error Resume Next
WScript.Echo "WSH Version: " & WScript.Version
Wscript.Echo "VBScript Version: " & ScriptEngineMajorVersion _
    & "." & ScriptEngineMinorVersion
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer _
        & "\root\cimv2")
Set colWMISettings = objWMIService.ExecQuery _
    ("Select * from Win32_WMISetting")
For Each objWMISetting in colWMISettings
    Wscript.Echo "WMI Version: " & objWMISetting.BuildVersion
Next
Set objShell = CreateObject("WScript.Shell")
strAdsiVersion = objShell.RegRead("HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{E92B03AB-B707-11d2-9CBD-0000F87A369E}\Version")
If strAdsiVersion = vbEmpty Then
    strAdsiVersion = objShell.RegRead("HKLM\SOFTWARE\Microsoft\ADs\Providers\LDAP\")
    If strAdsiVersion = vbEmpty Then
        strAdsiVersion = "ADSI is not installed."
    Else
        strAdsiVersion = "2.0"
    End If
End If
WScript.Echo "ADSI Version: " & strAdsiVersion

;代码结束==========================================
.再来传一个WMI的有关工具,这个还是从MS网站上搞下来的.MS把这个东西吹的很好哟.这个实际上是一个HTML文件.我把代码贴上来,请复制所有代码到文本文件中,然后保存为"scriptomatic.hta"双击运行即可.
;代码开始====================================
<html>
<!--********************************************************************
'*
'*  File:           scriptomatic.hta
'*  Created:        August 2002
'*  Version:        1.0
'*
'*  Description:    Learning tool. Enables users to generate and run
'*                  WSH scripts (in VBScript) that use WMI to display
'*                  properties available through the Win32_ classes.      
'*
'*
'* Copyright (C) 2002 Microsoft Corporation
'*
'********************************************************************-->
<title>Windows .NET Server Resource Kit - Scriptomatic</title>

<HTA:APPLICATION
     ID="objScriptomatic"
     APPLICATIONNAME="Scriptomatic"
     SCROLL="no"
     SINGLEINSTANCE="yes"
     WINDOWSTATE="normal"
>
<head>

<style>
BODY
{
   background-color: buttonface;
   font-family: Helvetica;
   font-size: 8pt;
   margin-top: 10px;
   margin-left: 10px;
   margin-right: 10px;
   margin-bottom: 10px;
}


.button
{
   font-family: Helvetica;
   font-size: 8pt;
   width: 35px;
}

textarea
{
   font-family: arial;
   font-size: 8pt;
   margin-left: 3px;
}

select
{
   font-family: arial;
   font-size: 8pt;
   width: 450px;
   margin-left: 0px;
}

</style>

<script language="vbscript">

'*********************************************
'* WHILE LOADING...
'*
'* As the application loads, we open a new
'* browser window to act as a crude progress dialog
'* while we wait for the enumeration of the WMI
'* classes to complete.
'*
'* We minimize the parent window prior to presenting
'* the progress dialog and resize it back to normal
'* once the classes are enumerated.
'*
'*********************************************

Sub Window_Onload

   '* resize parent window

   self.ResizeTo 1,1
   self.MoveTo 300,300
   
   '* create dialog window

   Set objDialogWindow = window.Open("about:blank","ProgressWindow","height=15,width=250,left=300,top=300,status=no,titlebar=no,toolbar=no,menubar=no,location=no,scrollbars=no")
   objDialogWindow.Focus()
   objDialogWindow.ResizeTo 250,15
   objDialogWindow.document.body.style.fontFamily = "Helvetica"
   objDialogWindow.document.body.style.fontSize = "11pt"
   objDialogWindow.document.writeln "<html><body>Loading WMI Classes.</body></html>"
   objDialogWindow.document.title = "Please wait."
   objDialogWindow.document.body.style.backgroundColor = "buttonface"
   objDialogWindow.document.body.style.borderStyle = "none"
   objDialogWindow.document.body.style.marginTop = 15

   '****************************************************************************
   '* enumerate the WMI classes in the cimv2 namespace, filling up a recordset
   '* with the names of the classes that begin with Win32_ and are not association
   '* classes. we'll use the class names stored in the recordset to populate a
   '* pulldown.
   '*****************************************************************************

   Const adVarChar = 200
   Const MaxCharacters = 255
   strComputer = "."
   
   Set rsDataList = CreateObject("ADODB.Recordset")
   rsDataList.Fields.Append "ClassName", adVarChar, MaxCharacters
   rsDataList.Open

   Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
   
   iCounter = 0
   For Each objclass in objWMIService.SubclassesOf()

   '* write a . to the dialog window once for every 250 classes
   '* to let the user know something is still happening.

      iCounter = iCounter + 1
      If iCounter Mod 250 = 0 Then
         objDialogWindow.document.writeln "."
      End If
      bIsQualifier = False
      If UCase(Left(objClass.Path_.Class,5)) = "WIN32" Then
         For Each Qualifier in objClass.Qualifiers_
            If UCase(Trim(Qualifier.Name)) = "ASSOCIATION" Then
               bIsQualifier = True
            End If
         Next

   '* the class name starts with win32_ and is not an association
   '* class - so append it to the recordset

         If bIsQualifier = False Then
            rsDataList.AddNew
            rsDataList("ClassName") = objClass.Path_.Class
            rsDataList.Update
         End If
      End If
   Next

   '* populate the pulldown

   rsDataList.Sort = "ClassName"
   rsDataList.MoveFirst
   strHTML = "<select onChange=""ComposeCode()"" name=ClassesPulldown>" &_
             "<option value=""PulldownMessage"">Begin by selecting a class"
   Do Until rsDataList.EOF
      strHTML = strHTML & "<option value= " & chr(34) &_
      rsDataList.Fields.Item("ClassName") & chr(34) &_
      ">" & rsDataList.Fields.Item("ClassName")
      rsDataList.MoveNext
   Loop
   strHTML = strHTML & "</select>"
   wmi_classes.insertAdjacentHTML "beforeEnd", strHTML


   '* the classes are enumerated, close the progress dialog
   '* and resize the main window

   objDialogWindow.Close
   self.Focus()
   self.ResizeTo 670,550
   self.MoveTo 200,200
   
   '* the user hasn't had a chance to select a class and generate
   '* a script - so disable the run and save buttons because
   '* they are not yet meaningful.
   
   run_button.disabled = True
   save_button.disabled = True

End Sub

'****************************************************************************
'* when the user selects a class from the pulldown, the ComposeCode subroutine
'* is called. it queries WMI to determine the properties of the class the user
'* selected and uses the information to construct sample code which it puts
'* in the main window's textarea.
'****************************************************************************

Sub ComposeCode

   '* if the user happens to select the message instead of a class, just
   '* disable the run and save buttons and exit the subroutine

   If ClassesPulldown.Value = "PulldownMessage" Then
      run_button.disabled = True
      save_button.disabled = True
      Exit Sub
   End If

   strComputer = "."
   Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
   Set objClass = objWMIService.Get(ClassesPulldown.Value)
   strHTML = "<textarea cols=100 rows=30>"
   strHTML = strHTML & "On Error Resume Next" & Chr(10)
   strHTML = strHTML & "strComputer = " & chr(34) & "." & chr(34) & Chr(10)
   strHTML = strHTML & "Set objWMIService = GetObject(" & chr(34) & "winmgmts:\\" & chr(34) & " & strComputer & " & chr(34) & "\root\cimv2" & chr(34) & ")" & Chr(10)
   strHTML = strHTML & "Set colItems = objWMIService.ExecQuery(" & chr(34) & "Select * from " & ClassesPulldown.value & chr(34) & ",,48)" & Chr(10)
   strHTML = strHTML & "For Each objItem in colItems" & Chr(10)
   For Each objProperty in objClass.properties_
      strHTML = strHTML & "&nbsp; &nbsp; Wscript.Echo " & chr(34) & objProperty.name & ": " & chr(34) & " & " & "objItem." & objProperty.name & Chr(10)
   Next
   strHTML = strHTML & "Next" & "</textarea>"
   code.InnerHTML= strHTML

   '* once the code is successfully composed and put into the textarea, ensure
   '* that the run and save buttons are enabled

   run_button.disabled = False
   save_button.disabled = False

End Sub

'****************************************************************************
'* when the user presses the Run button, we use the WshShell object's Run
'* method to run the code currently in the textarea under cscript.exe. we use
'* cmd.exe's /k parameter to ensure the command window remains visible after
'* the script has finished running.
'****************************************************************************

Sub RunScript

   Set objFS = CreateObject("Scripting.FileSystemObject")
   strTmpName = "temp_script.vbs"
   Set objScript = objFS.CreateTextFile(strTmpName)
   objScript.Write code.InnerText
   objScript.Close
   Set objShell = CreateObject("WScript.Shell")
   strCmdLine = "cmd /k cscript.exe "
   strCmdLine = strCmdLine & strTmpName
   objShell.Run(strCmdLine)

End Sub

'****************************************************************************
'* when the user presses the Save button, we present them with an InputBox
'* and force them to give us the full path to where they'd like to the save
'* the script that is currently in the textarea. The user is probably quite
'* upset with our laziness here....and who can blame them?
'****************************************************************************

Sub SaveScript

   Set objFSO = CreateObject("Scripting.FileSystemObject")
   strSaveFileName = InputBox("Please enter the complete path where you want to save your script (for example, C:\Scripts\MyScript.vbs).")
   If strSaveFileName = "" Then
      Exit Sub
   End If

   Set objFile = objFSO.CreateTextFile(strSaveFileName)
   objFile.WriteLine code.InnerText
   objFile.Close

End Sub


'****************************************************************************
'* when the user presses the Open button, we present them with an InputBox
'* and force them to give us the full path to the script they'd like to open.
'* This is, of course, rather wonky - but it's meant to be.
'****************************************************************************

Sub OpenScript

   Set objFSO = CreateObject("Scripting.FileSystemObject")
   strOpenFileName = InputBox("Please enter the complete path name for your script (for example, C:\Scripts\MyScript.vbs).")
   If strOpenFileName = "" Then
      Exit Sub
   End If

   Set objFile = objFSO.OpenTextFile(strOpenFileName)
   strHTML = "<textarea cols=100 rows=30>"
   strHTML = strHTML & objFile.ReadAll()
   strHTML = strHTML & "</textarea>"
   code.InnerHTML =  strHTML
   objFile.Close
   run_button.disabled = False
   save_button.disabled = False

End Sub

'****************************************************************************
'* when the user presses the Quit button, the file where we've been storing
'* the scripts gets deleted and the main window closes.
'****************************************************************************

Sub QuitScript

   On Error Resume Next
   Set objFSO = CreateObject("Scripting.FileSystemObject")
   objFSO.DeleteFile "temp_script.vbs"
   Set objFSO = Nothing
   self.Close()

End Sub


</script>
</head>


'***********************************************************
'* our HTML layout - the only thing of note here is that when
'* each of the buttons is pressed (clicked), their onClick
'* attributes causes the appropriate subroutine to be called
'***********************************************************

<body>

<table>
   <td>
      <span id="wmi_classes">&nbsp;</span>
      <input id=runbutton  class="button" type="button" value="Run"  name="run_button"  onClick="RunScript()">
      <input id=savebutton class="button" type="button" value="Save" name="save_button" onClick="SaveScript()">
      <input id=openbutton class="button" type="button" value="Open" name="open_button" onClick="OpenScript()">
      <input id=quitbutton class="button" type="button" value="Quit" name="quit_button" onClick="QuitScript()">
      <div ID=code_header></div>
      <div id="code"></div>
   </td>
</tr>
</table>



</body>

</html>

;代码结束==============================================
9.再来一个WMI脚本教程.这个也是从网络上搜集的,不记得下载地址了.好象里面差一个第四章的,可以自己到网络上搜索,好象在MS网站也有,地址是http://www.microsoft.com/china/M ... inicscripting.mspx.

下载地址:http://zhenlove.com.cn/cndos/fileup/files/wmi脚本入门(pdf不完整).rar

8.再来一个WMI查询分析工具.是外国网站的.里面赋有源代码,不下载的要后悔哟.不过我的电脑上运行不了该程序,不知道为什么,大家测试反馈下是什么问题.谢谢。
下载地址:
http://zhenlove.com.cn/cndos/fileup/files/WQLAnalyzer_1.02(wmi查询分析工具有源代码).zip

10.《WINDOWS WMI参考》,由于这个只能在网络上阅读,找不到相关的电子书下载,所以就把所有抓的网页发上来。其中名称前面的数字代表章节号,如0101代表第一章第一节,050105代表第五章-第一节-第一小节。
下载地址:
http://zhenlove.com.cn/cndos/fileup/files/windowswmi参考.rar
11.《WMI开发工具包》,这个是直接从MS 网站上下的,其中已经包含前面发的wmisdk(WMI开发文档).rar,所以下载这个的可以不再下载上面的哪个。
http://zhenlove.com.cn/cndos/fileup/files/
wmisdk(WMI开发工具包).rar

[ Last edited by HUNRYBECKY on 2006-12-18 at 12:06 PM ]
作者: HUNRYBECKY     时间: 2006-12-13 02:17
不好意思,搞掉了一个。
《WMI开发文档》开发文档的下载地址是:http://zhenlove.com.cn/cndos/fileup/files/wmisdk(WMI开发文档).rar
作者: lxmxn     时间: 2006-12-13 02:21

  正在下载中……

  建议把《WMI开发技术文档》的下载链接也打上来。还不知道里面关于WMIC的内容有多少,因为这是命令行方式的命令,所以主要还是发关于WMIC的比较好。如果WMI里面包含了WMIC的内容就最好不过了。

作者: lxmxn     时间: 2006-12-13 02:22

  汗一个先……
  
  发晚了一步。

作者: HUNRYBECKY     时间: 2006-12-13 02:23
WMI是包含WMIC的。所以可以下载哈。
作者: HUNRYBECKY     时间: 2006-12-13 02:26
3.《WMIC:从命令行对Windows的全面管理》:在补一个,这个是从网络上收集的,也不知道是从那里下载的了。
下载地址:
http://zhenlove.com.cn/cndos/fileup/files/WMIC从命令行对Windows的全面管理.rar
作者: HUNRYBECKY     时间: 2006-12-13 02:28
这里的上传系统好慢呀。传一个《WMI技术指南》都花了我两个小时。
作者: lxmxn     时间: 2006-12-13 02:29

  2楼中的链接无法下载,提示找不到资源。

作者: lxmxn     时间: 2006-12-13 02:30

  6楼同样的问题。

作者: HUNRYBECKY     时间: 2006-12-13 02:32
2楼以下的都还在上传中,因为上传系统说了:下载地址前面不变,后面的就是文件名,所以传完后应该可以连接,如果不行,通知我修正下。
作者: lxmxn     时间: 2006-12-13 02:34

  晕死,还没有完全上传上去你就把地址帖出来啊?汗一个先……

作者: HUNRYBECKY     时间: 2006-12-13 02:35
2楼的已经传完,连接果然是正确的。不好意思,我这里传,很慢,所以先发帖,呵呵,太难等了。
作者: HUNRYBECKY     时间: 2006-12-13 02:44
4.再来一段关于WMI的脚本,该脚本来自MS网站,原内容有点问题,稍微修正了一下.要运行该脚本,请复制代码到记事本中并保存为"search.vbs",注意保存时必须加引号,否则不是脚本文件而是文本文件;然后到CMD下使用命令,格式如下:Search.vbs 类关键字,该脚本可以实现搜索WMI CLASS的是属性等.
;代码开始=============================================
Set args = wscript.arguments
If args.Count <= 0 Then
    Wscript.Echo "Tool to search for a matching class in the WMI Repository. "
    Wscript.Echo "USAGE: <keywordToSearch> [<namespaceToSearchIn>]"
    Wscript.Echo "Example1: Cscript search.vbs service"
    Wscript.Echo "Example2: Cscript search.vbs video root\cimv2"
Else
    ' If no Namespace is specified then the Default is the ROOT namespace
    rootNamespace = "\\.\ROOT"
    keyword = args(0)
    If args.Count > 1 Then
        rootNamespace = args(1)
    End If   
    EnumNameSpace rootNamespace
    Wscript.Echo vbNewLine
End if
  
' Subroutine to recurse through the namespaces

Sub EnumNameSpace(parentNamespaceName)

Set objService = GetObject("winmgmts:" & parentNamespaceName)

Set collMatchingClasses = objService.Execquery _
    ("Select * From meta_class Where __class " & _
    "Like '%" & keyword & "%'")
If (collMatchingClasses.count > 0) Then
    Wscript.Echo vbNewLine
    Wscript.Echo vbNewLine
    Wscript.Echo "Matching Classes Under Namespace: " & parentNamespaceName

    For Each matchingClass in collMatchingClasses
        Wscript.Echo "    " & matchingClass.Path_.CLASS
    Next   
End if

Set collSubNamespaces = objService.Execquery _
    ("select * from __namespace")
For Each subNameSpace in collSubNamespaces
    EnumNameSpace subNameSpace.path_.namespace + _
        "\" + subNameSpace.Name
Next

End Sub
;代码结束======================================================
作者: lxmxn     时间: 2006-12-13 02:44

  恩,可以了,三个文件全部下载完毕,感谢。

作者: HUNRYBECKY     时间: 2006-12-13 02:48
5.在来一个有关WMI CLASS的资料,这个资料同样来源于MS网站,下载地址:http://zhenlove.com.cn/cndos/fileup/files/WMI Classes.rar
作者: HUNRYBECKY     时间: 2006-12-13 02:51
6.再来一段关于检查电脑所有脚本版本检测的有关脚本,请把代码保存为version.vbs.双击运行或在CMD下输入 start version.vbs (注意匹配自己的路径)
;代码开始===============================================
On Error Resume Next
WScript.Echo "WSH Version: " & WScript.Version
Wscript.Echo "VBScript Version: " & ScriptEngineMajorVersion _
    & "." & ScriptEngineMinorVersion
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer _
        & "\root\cimv2")
Set colWMISettings = objWMIService.ExecQuery _
    ("Select * from Win32_WMISetting")
For Each objWMISetting in colWMISettings
    Wscript.Echo "WMI Version: " & objWMISetting.BuildVersion
Next
Set objShell = CreateObject("WScript.Shell")
strAdsiVersion = objShell.RegRead("HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{E92B03AB-B707-11d2-9CBD-0000F87A369E}\Version")
If strAdsiVersion = vbEmpty Then
    strAdsiVersion = objShell.RegRead("HKLM\SOFTWARE\Microsoft\ADs\Providers\LDAP\")
    If strAdsiVersion = vbEmpty Then
        strAdsiVersion = "ADSI is not installed."
    Else
        strAdsiVersion = "2.0"
    End If
End If
WScript.Echo "ADSI Version: " & strAdsiVersion

;代码结束==========================================
作者: kcdsw     时间: 2006-12-13 02:55
我都能下  600K / s
作者: namejm     时间: 2006-12-13 02:58
  资料很好,加分鼓励。

  链接地址有脱节的现象,点下去之后不能正确跳转,如果能修正一下就好了。
作者: HUNRYBECKY     时间: 2006-12-13 02:58
7.再来传一个WMI的有关工具,这个还是从MS网站上搞下来的.MS把这个东西吹的很好哟.这个实际上是一个HTML文件.我把代码贴上来,请复制所有代码到文本文件中,然后保存为"scriptomatic.hta"双击运行即可.
;代码开始====================================
<html>
<!--********************************************************************
'*
'*  File:           scriptomatic.hta
'*  Created:        August 2002
'*  Version:        1.0
'*
'*  Description:    Learning tool. Enables users to generate and run
'*                  WSH scripts (in VBScript) that use WMI to display
'*                  properties available through the Win32_ classes.      
'*
'*
'* Copyright (C) 2002 Microsoft Corporation
'*
'********************************************************************-->
<title>Windows .NET Server Resource Kit - Scriptomatic</title>

<HTA:APPLICATION
     ID="objScriptomatic"
     APPLICATIONNAME="Scriptomatic"
     SCROLL="no"
     SINGLEINSTANCE="yes"
     WINDOWSTATE="normal"
>
<head>

<style>
BODY
{
   background-color: buttonface;
   font-family: Helvetica;
   font-size: 8pt;
   margin-top: 10px;
   margin-left: 10px;
   margin-right: 10px;
   margin-bottom: 10px;
}


.button
{
   font-family: Helvetica;
   font-size: 8pt;
   width: 35px;
}

textarea
{
   font-family: arial;
   font-size: 8pt;
   margin-left: 3px;
}

select
{
   font-family: arial;
   font-size: 8pt;
   width: 450px;
   margin-left: 0px;
}

</style>

<script language="vbscript">

'*********************************************
'* WHILE LOADING...
'*
'* As the application loads, we open a new
'* browser window to act as a crude progress dialog
'* while we wait for the enumeration of the WMI
'* classes to complete.
'*
'* We minimize the parent window prior to presenting
'* the progress dialog and resize it back to normal
'* once the classes are enumerated.
'*
'*********************************************

Sub Window_Onload

   '* resize parent window

   self.ResizeTo 1,1
   self.MoveTo 300,300
   
   '* create dialog window

   Set objDialogWindow = window.Open("about:blank","ProgressWindow","height=15,width=250,left=300,top=300,status=no,titlebar=no,toolbar=no,menubar=no,location=no,scrollbars=no")
   objDialogWindow.Focus()
   objDialogWindow.ResizeTo 250,15
   objDialogWindow.document.body.style.fontFamily = "Helvetica"
   objDialogWindow.document.body.style.fontSize = "11pt"
   objDialogWindow.document.writeln "<html><body>Loading WMI Classes.</body></html>"
   objDialogWindow.document.title = "Please wait."
   objDialogWindow.document.body.style.backgroundColor = "buttonface"
   objDialogWindow.document.body.style.borderStyle = "none"
   objDialogWindow.document.body.style.marginTop = 15

   '****************************************************************************
   '* enumerate the WMI classes in the cimv2 namespace, filling up a recordset
   '* with the names of the classes that begin with Win32_ and are not association
   '* classes. we'll use the class names stored in the recordset to populate a
   '* pulldown.
   '*****************************************************************************

   Const adVarChar = 200
   Const MaxCharacters = 255
   strComputer = "."
   
   Set rsDataList = CreateObject("ADODB.Recordset")
   rsDataList.Fields.Append "ClassName", adVarChar, MaxCharacters
   rsDataList.Open

   Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
   
   iCounter = 0
   For Each objclass in objWMIService.SubclassesOf()

   '* write a . to the dialog window once for every 250 classes
   '* to let the user know something is still happening.

      iCounter = iCounter + 1
      If iCounter Mod 250 = 0 Then
         objDialogWindow.document.writeln "."
      End If
      bIsQualifier = False
      If UCase(Left(objClass.Path_.Class,5)) = "WIN32" Then
         For Each Qualifier in objClass.Qualifiers_
            If UCase(Trim(Qualifier.Name)) = "ASSOCIATION" Then
               bIsQualifier = True
            End If
         Next

   '* the class name starts with win32_ and is not an association
   '* class - so append it to the recordset

         If bIsQualifier = False Then
            rsDataList.AddNew
            rsDataList("ClassName") = objClass.Path_.Class
            rsDataList.Update
         End If
      End If
   Next

   '* populate the pulldown

   rsDataList.Sort = "ClassName"
   rsDataList.MoveFirst
   strHTML = "<select onChange=""ComposeCode()"" name=ClassesPulldown>" &_
             "<option value=""PulldownMessage"">Begin by selecting a class"
   Do Until rsDataList.EOF
      strHTML = strHTML & "<option value= " & chr(34) &_
      rsDataList.Fields.Item("ClassName") & chr(34) &_
      ">" & rsDataList.Fields.Item("ClassName")
      rsDataList.MoveNext
   Loop
   strHTML = strHTML & "</select>"
   wmi_classes.insertAdjacentHTML "beforeEnd", strHTML


   '* the classes are enumerated, close the progress dialog
   '* and resize the main window

   objDialogWindow.Close
   self.Focus()
   self.ResizeTo 670,550
   self.MoveTo 200,200
   
   '* the user hasn't had a chance to select a class and generate
   '* a script - so disable the run and save buttons because
   '* they are not yet meaningful.
   
   run_button.disabled = True
   save_button.disabled = True

End Sub

'****************************************************************************
'* when the user selects a class from the pulldown, the ComposeCode subroutine
'* is called. it queries WMI to determine the properties of the class the user
'* selected and uses the information to construct sample code which it puts
'* in the main window's textarea.
'****************************************************************************

Sub ComposeCode

   '* if the user happens to select the message instead of a class, just
   '* disable the run and save buttons and exit the subroutine

   If ClassesPulldown.Value = "PulldownMessage" Then
      run_button.disabled = True
      save_button.disabled = True
      Exit Sub
   End If

   strComputer = "."
   Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
   Set objClass = objWMIService.Get(ClassesPulldown.Value)
   strHTML = "<textarea cols=100 rows=30>"
   strHTML = strHTML & "On Error Resume Next" & Chr(10)
   strHTML = strHTML & "strComputer = " & chr(34) & "." & chr(34) & Chr(10)
   strHTML = strHTML & "Set objWMIService = GetObject(" & chr(34) & "winmgmts:\\" & chr(34) & " & strComputer & " & chr(34) & "\root\cimv2" & chr(34) & ")" & Chr(10)
   strHTML = strHTML & "Set colItems = objWMIService.ExecQuery(" & chr(34) & "Select * from " & ClassesPulldown.value & chr(34) & ",,48)" & Chr(10)
   strHTML = strHTML & "For Each objItem in colItems" & Chr(10)
   For Each objProperty in objClass.properties_
      strHTML = strHTML & "&nbsp; &nbsp; Wscript.Echo " & chr(34) & objProperty.name & ": " & chr(34) & " & " & "objItem." & objProperty.name & Chr(10)
   Next
   strHTML = strHTML & "Next" & "</textarea>"
   code.InnerHTML= strHTML

   '* once the code is successfully composed and put into the textarea, ensure
   '* that the run and save buttons are enabled

   run_button.disabled = False
   save_button.disabled = False

End Sub

'****************************************************************************
'* when the user presses the Run button, we use the WshShell object's Run
'* method to run the code currently in the textarea under cscript.exe. we use
'* cmd.exe's /k parameter to ensure the command window remains visible after
'* the script has finished running.
'****************************************************************************

Sub RunScript

   Set objFS = CreateObject("Scripting.FileSystemObject")
   strTmpName = "temp_script.vbs"
   Set objScript = objFS.CreateTextFile(strTmpName)
   objScript.Write code.InnerText
   objScript.Close
   Set objShell = CreateObject("WScript.Shell")
   strCmdLine = "cmd /k cscript.exe "
   strCmdLine = strCmdLine & strTmpName
   objShell.Run(strCmdLine)

End Sub

'****************************************************************************
'* when the user presses the Save button, we present them with an InputBox
'* and force them to give us the full path to where they'd like to the save
'* the script that is currently in the textarea. The user is probably quite
'* upset with our laziness here....and who can blame them?
'****************************************************************************

Sub SaveScript

   Set objFSO = CreateObject("Scripting.FileSystemObject")
   strSaveFileName = InputBox("Please enter the complete path where you want to save your script (for example, C:\Scripts\MyScript.vbs).")
   If strSaveFileName = "" Then
      Exit Sub
   End If

   Set objFile = objFSO.CreateTextFile(strSaveFileName)
   objFile.WriteLine code.InnerText
   objFile.Close

End Sub


'****************************************************************************
'* when the user presses the Open button, we present them with an InputBox
'* and force them to give us the full path to the script they'd like to open.
'* This is, of course, rather wonky - but it's meant to be.
'****************************************************************************

Sub OpenScript

   Set objFSO = CreateObject("Scripting.FileSystemObject")
   strOpenFileName = InputBox("Please enter the complete path name for your script (for example, C:\Scripts\MyScript.vbs).")
   If strOpenFileName = "" Then
      Exit Sub
   End If

   Set objFile = objFSO.OpenTextFile(strOpenFileName)
   strHTML = "<textarea cols=100 rows=30>"
   strHTML = strHTML & objFile.ReadAll()
   strHTML = strHTML & "</textarea>"
   code.InnerHTML =  strHTML
   objFile.Close
   run_button.disabled = False
   save_button.disabled = False

End Sub

'****************************************************************************
'* when the user presses the Quit button, the file where we've been storing
'* the scripts gets deleted and the main window closes.
'****************************************************************************

Sub QuitScript

   On Error Resume Next
   Set objFSO = CreateObject("Scripting.FileSystemObject")
   objFSO.DeleteFile "temp_script.vbs"
   Set objFSO = Nothing
   self.Close()

End Sub


</script>
</head>


'***********************************************************
'* our HTML layout - the only thing of note here is that when
'* each of the buttons is pressed (clicked), their onClick
'* attributes causes the appropriate subroutine to be called
'***********************************************************

<body>

<table>
   <td>
      <span id="wmi_classes">&nbsp;</span>
      <input id=runbutton  class="button" type="button" value="Run"  name="run_button"  onClick="RunScript()">
      <input id=savebutton class="button" type="button" value="Save" name="save_button" onClick="SaveScript()">
      <input id=openbutton class="button" type="button" value="Open" name="open_button" onClick="OpenScript()">
      <input id=quitbutton class="button" type="button" value="Quit" name="quit_button" onClick="QuitScript()">
      <div ID=code_header></div>
      <div id="code"></div>
   </td>
</tr>
</table>



</body>

</html>

;代码结束==============================================
作者: HUNRYBECKY     时间: 2006-12-13 03:00


  Quote:
Originally posted by namejm at 2006-12-13 02:58:
  资料很好,加分鼓励。

  链接地址有脱节的现象,点下去之后不能正确跳转,如果能修正一下就好了。

namejm斑竹:连接是有点问题,我复制过来就这样,不知道是不是上传系统的问题,所以下载的时候要时候一定要复制整个正确的连接然后在浏览地址中输入回车就可以下载了.
作者: HUNRYBECKY     时间: 2006-12-13 03:03
注意<WMI技术指南>是一个压缩包,里面有个文本文件,里面有密码和打开方式.该PDF必须使用7.0的才能打开.
作者: HUNRYBECKY     时间: 2006-12-13 03:08
8.再来一个WMI查询分析工具.是外国网站的.里面赋有源代码,不下载的要后悔哟.不过我的电脑上运行不了该程序,不知道为什么,大家测试反馈下是什么问题.谢谢。
下载地址:
http://zhenlove.com.cn/cndos/fileup/files/WQLAnalyzer_1.02(wmi查询分析工具有源代码).zip
作者: HUNRYBECKY     时间: 2006-12-13 03:15
9.再来一个WMI脚本教程.这个也是从网络上搜集的,不记得下载地址了.好象里面差一个第四章的,可以自己到网络上搜索,好象在MS网站也有,地址是http://www.microsoft.com/china/M ... inicscripting.mspx.

下载地址:http://zhenlove.com.cn/cndos/fileup/files/wmi脚本入门(pdf不完整).rar


我搜集的所有的有关WMI WMIC的资料已经发完.
作者: lxmxn     时间: 2006-12-13 03:26


  Quote:
Originally posted by kcdsw at 2006-12-13 02:55:
我都能下  600K / s


  我下载的时候,楼主还没有上传完整,所以不能下载。你能下载是因为群主已经全部上传完毕了。
  600k/s??接的什么线哦?我这里用迅雷最快不过50k/s,汗……

作者: lxmxn     时间: 2006-12-13 03:29

  提供这么多资料,加分鼓励一下。

作者: HUNRYBECKY     时间: 2006-12-13 03:43
希望大家搜集的WMI WMIC有关的资料都贴到这里来,丰富相关资料,为批处理编程提供参考资料,最好不要相同。
作者: kcdsw     时间: 2006-12-13 09:23
呵呵     我接的是宽带啊
附件 1: 新建 BMP 图像.JPG (2006-12-13 09:23, 22.58 K, 下载附件所需积分 1点 ,下载次数: 3)



作者: vkill     时间: 2006-12-14 05:48
很好哈~谢谢
作者: 9527     时间: 2006-12-14 05:57
我以为是电子书呢?唉,这本书早在2年前就有了,看下图,主要是WMI的讲解,还有,除了书还有我的那只手(刚刚拍的,呵呵 .............)
作者: lxmxn     时间: 2006-12-14 06:01

  9527,你~~
  
  有好东西不分享?!!

作者: a9319751     时间: 2006-12-14 06:02
不错,谢谢
作者: redtek     时间: 2006-12-14 21:28
多谢HUNRYBECKY兄分享这么好的资料~:)
作者: HUNRYBECKY     时间: 2006-12-14 22:54


  Quote:
Originally posted by 9527 at 2006-12-14 05:57:
我以为是电子书呢?唉,这本书早在2年前就有了,看下图,主要是WMI的讲解,还有,除了书还有我的那只手(刚刚拍的,呵呵 .............)

是呀,你有为什么不拿出来分享呀,老实交代,你还有什么好东西,快拿出来大家分享!有其他好书就麻烦扫描制作PDF文档 :-)
作者: HUNRYBECKY     时间: 2006-12-14 22:56


  Quote:
Originally posted by kcdsw at 2006-12-13 09:23:
呵呵     我接的是宽带啊

速度还真快,光IE就这么快。什么宽贷呀。你一定离CN-DOS的服务器很近吧?
作者: dbc6013     时间: 2006-12-14 23:25
先顶了,在说
作者: wangguojun010     时间: 2006-12-15 23:00
谢谢了,为啥我不能下载呢?
作者: HUNRYBECKY     时间: 2006-12-16 02:10


  Quote:
Originally posted by wangguojun010 at 2006-12-15 23:00:
谢谢了,为啥我不能下载呢?

不要直接点连接,因为连接贴上去的时候有点问题。如要下载:[http://zhenlove.com.cn/cndos/fileup/files/WQLAnalyzer_1.02(wmi查询分析工具有源代码).zip] 可以把包含扩展名在一起的地方(方括号)复制到浏览器地址中回车就可以下了。
作者: HUNRYBECKY     时间: 2006-12-16 21:43
10.再来一个《WINDOWS WMI参考》,由于这个只能在网络上阅读,找不到相关的电子书下载,所以就把所有抓的网页发上来。其中名称前面的数字代表章节号,如0101代表第一章第一节,050105代表第五章-第一节-第一小节。
下载地址:
http://zhenlove.com.cn/cndos/fileup/files/windowswmi参考.rar
作者: HUNRYBECKY     时间: 2006-12-16 21:52
11.在发一个WMI开发工具包,这个是直接从MS 网站上下的,其中已经包含前面发的wmisdk(WMI开发文档).rar,所以下载这个的可以不再下载上面的哪个。
http://zhenlove.com.cn/cndos/fileup/files/
wmisdk(WMI开发工具包).rar
作者: sunya     时间: 2006-12-17 00:15
中午资料不多啊,英文不好
作者: yardian     时间: 2006-12-17 00:43
建议把资料都整理到顶楼中
作者: hike     时间: 2006-12-17 22:27
谢谢,下载很快
作者: hepengking     时间: 2007-3-9 23:43
下载中。。。。。。。。感谢楼主收集了这么多资料,辛苦了。
作者: minmin888     时间: 2007-4-20 00:29
学习中
作者: minmin888     时间: 2007-5-7 19:59
谢谢各位兄弟分享!
作者: figod     时间: 2007-6-16 17:20
wmi技术指南的链接失效了 哪位能上传一下么 谢谢了~~
作者: qinbuer     时间: 2007-6-16 19:44
好!!!
作者: tclgb     时间: 2007-7-9 01:02
好!!!
作者: shale     时间: 2007-10-12 23:59
9527,你~~
  
  有好东西不分享?!!
作者: uiopuiop     时间: 2007-10-13 14:26    标题: 无法下载, 空间被冻结了

无法下载, 空间被冻结了!
请重新上传, 多谢!

有下载过的,请把附件贴上来。
作者: juyz     时间: 2007-12-12 11:31
因上传木马病毒,该空间被冻结,请联系QQ:34675205。
作者: huobilie     时间: 2008-2-25 19:33
为什么我什么都下不了?
作者: asp     时间: 2008-12-2 14:48
斑竹,下载不了,我也给个地址,
http://www.microsoft.com/china/t ... center/default.mspx
另外,windowsXP home版在cmd下不能直接用wmic,要到其他的windows版本下copy wmic.exe,路径为c;\windows\system32\wbem