Users Guide
objInstance.Properties_.Item(strPropName).Value=3
objInstance.Put_
'***Ifanyerrorsoccurred,lettheuserknow
IfErr.Number<>0Then
WScript.Echo"SettingPXEonnextrebootfailed."
EndIf
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//nologoSampleForcePXE.vbs<systemname>"
WScript.Echo strMessage
End Sub
('****************************************************
'*** 名称:SampleForcePXE.vbs
'*** 目的:强制 Dell OMCI 客户端在下次重新引导时引导 PXE。
'*** 用法:cscript.exe //nologo SampleForcePXE.vbs <系统名称>
'***
'*** 此示例脚本只是一个示例,未经
'*** 测试,Dell 也不作任何担保;Dell 对
'*** 相关的责任概不负责。Dell 对
'*** 该脚本不提供任何技术支持。有关 WMI
'*** 脚本的详情,请参阅适用的 Microsoft 说明文件。
'****************************************************
选项显式
'*** 声明变量
Dim strNameSpace
Dim strComputerName
Dim strClassName
Dim strKeyValue
Dim objInstance
Dim strPropName
Dim strPropValue
'*** 确认使用了正确的可执行文件运行脚本
'*** 并且所有参数均已传递
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"
strKeyValue = "Configuration"
strPropName = "ForcePXEOnNextBoot"
'*** 检索 Dell_Configuration 类的实例(只能
'*** 有 1 个实例)。
Set objInstance = GetObject("WinMgmts:{impersonationLevel=impersonate}//" &_
strComputerName&"/"&strNameSpace&":"&strClassName&"="&_
Chr(34)&strKeyValue&Chr(34))
strPropValue = objInstance.Properties_.Item(strPropName).Value
'*** 设置该属性的新值并保存实例,但只有
'*** 当前值不是 3("已启用")时才这样
If strPropValue <> 3 Then
objInstance.Properties_.Item(strPropName).Value=3
objInstance.Put_
'***如果出现任何错误,让用户知道
If Err.Number <> 0 Then
WScript.Echo"在下一次重新引导时设置 PXE 失败。"
End If
End If
'*** Sub 用于显示脚本的正确用法
Sub Usage()
Dim strMessage
strMessage = "语法不正确。应运行:" & vbCRLF & _
"cscript.exe//nologoSampleForcePXE.vbs<系统名称>"
WScript.Echo strMessage
End Sub)
启用通过 LAN 唤醒










