Users Guide
'*** Initialize variables
strNameSpace = "root/Dellomci"
strComputerName = WScript.Arguments(0)
strClassName = "Dell_Configuration"
strPropValue = "Configuration"
strMethod = "Shutdown"
'*** Retrieve the Dell_Configuration class
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.
If objOutParam.ReturnValue = 0 Then
WScript.Echo"Methodcompletedsuccessfully."
else
WScript.Echo"Methodfailed."
End If
'*** Sub used to display the correct usage of the script
Sub Usage()
Dim strMessage
strMessage = "incorrect syntax. You should run: " & vbCRLF & _
"cscript.exe//nologoSampleShutdown.vbs<systemname>"
WScript.Echo strMessage
End Sub
('****************************************************
'*** 名称:SampleShutdown.vbs
'*** 目的:关闭 Dell™ OMCI 客户端。
'*** 用法:cscript.exe //nologo SampleShutdown.vbs <系统名称>
'***
'*** 此示例脚本只是一个示例,未经
'*** 测试,Dell 也不作任何担保;Dell 对
'*** 相关的责任概不负责。Dell 对
'*** 该脚本不提供任何技术支持。有关
'*** WMI 脚本的详情,请参阅适用的 Microsoft®
'*** 说明文件。
'****************************************************
选项显式
'*** 声明变量
Dim strNameSpace
Dim strComputerName
Dim strClassName
Dim strPropValue
Dim objInstance
Dim ObjOutParam
Dim strMethod
'*** 确认使用了正确的可执行文件运行脚本
'*** 并且所有参数均已传递
If (LCase(Right(WScript.FullName, 11)) = "wscript.exe" ) Or _
(Wscript.Arguments.Count<1)Then
CallUsage()
WScript.Quit
End If
'*** 初始化变量
strNameSpace = "root/Dellomci"
strComputerName = WScript.Arguments(0)
strClassName = "Dell_Configuration"
strPropValue = "Configuration"
strMethod = "Shutdown"
'*** 检索 Dell_Configuration 类
Set objInstance = GetObject("WinMgmts:{impersonationLevel=impersonate}//" &_
strComputerName&"/"&strNameSpace&":"&strClassName)
'*** 执行 Shutdown 方法
Set ObjOutParam = objInstance.ExecMethod_(strMethod)
'*** 让用户知道方法是否返回成功
'*** 注:如果返回值为 0,并不意味着系统
'*** 已关闭,而只是意味着已成功启动 Shutdown
'*** 方法。
If objOutParam.ReturnValue = 0 Then
WScript.Echo"方法已成功完成。"
else
WScript.Echo"方法失败。"
End If
'*** Sub 用于显示脚本的正确用法










