Users Guide

返回目录页面
Dell™OpenManage™ClientInstrumentation7.5版用指南
WMI 样本脚本
OMCI 中支持的 BIOS 标记
WMI
关闭远程系
'*******************************************************************
'*** Name: SampleShutdown.vbs
'***Purpose:ToshutdownaDell™OMCIclient.
'*** Usage: cscript.exe //nologo SampleShutdown.vbs <systemname>
'***
'*** (名称:SampleShutdown.vbs
'*** 目的:关闭 Dell™ OMCI 客户机。
'*** 用法:cscript.exe //nologo SampleShutdown.vbs <系统名称>
'***
'*** This sample script is provided as an example only, and has not
'*** been tested, nor is warranted in any way by Dell; Dell disclaims
'*** any liability in connection therewith. Dell provides no
'*** technical support with regard to such scripting. For more
'*** information on WMI scripting, refer to applicable Microsoft®
'*** documentation.
'***
'*** (该样本脚本仅作为示例提供,未经过测试,也没有 Dell 任何形式的保证;
'*** 因此 Dell 否认对其承担任何连接义务。
'*** Dell 对该脚本不提供任何技术支持。
'*** 关于 WMI 脚本的更多信息,请参阅相关的 Microsoft® 说明文件。)
'*******************************************************************
Option Explicit
'*** Declare variables (声明变量)
Dim strNameSpace
Dim strComputerName
Dim strClassName
Dim strPropValue
Dim objInstance
Dim ObjOutParam
Dim strMethod
'*** Check that the right executable was used to run the script
'*** and that all parameters were passed
'***
'*** (检查运行脚本时使用正确的可执行文件,且所有参数都通过验证)
If (LCase(Right(WScript.FullName, 11)) = "wscript.exe" ) Or _
(Wscript.Arguments.Count<1)Then
CallUsage()
WScript.Quit
End If
'*** Initialize variables (初始化变量)
strNameSpace = "root/Dellomci"
strComputerName = WScript.Arguments(0)
strClassName = "Dell_Configuration"
strPropValue = "Configuration"
strMethod = "Shutdown"
'*** Retrieve the Dell_Configuration class (检索 Dell_配置类)
Set objInstance = GetObject("WinMgmts:{impersonationLevel=impersonate}//" &_
strComputerName&"/"&strNameSpace&":"&strClassName)
'*** Execute the Shutdown method (执行关闭系统方法)
Set ObjOutParam = objInstance.ExecMethod_(strMethod)
'*** Let the user know whether the method returned success or not
'*** Note: if return value is 0, it does not mean the system has
'*** shutdown, it only means that the shutdown method was initiated
'*** successfully.
'***
'*** (通知用户方法是否返回成功
'*** 注:如果返回值为 0,并不意味着系统已关闭,仅指关闭系统方法已成功初始化。)
If objOutParam.ReturnValue = 0 Then
WScript.Echo"Methodcompletedsuccessfully."
else