'*** 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. '*************************************************** Option Explicit
'*** Declare variables
Dim strNameSpace
Dim strComputerName
Dim strClassName
Dim strKeyValue
Dim objInstance
Dim strPropName
Dim strPropValue
'*** 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_SMBIOSsettings"
strKeyValue = "0"
strPropName = "ChassisIntrusionStatus"
'*** Retrieve the instance of Dell_SMBIOSSettings '***class (there should only be 1 instance).
'*** 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. '**************************************************** Option Explicit
'*** Declare variables
Dim objWMIService
Dim strNameSpace
Dim strComputerName
Dim strClassName
Dim ColSystem
Dim objInstance
Dim strPropName
Dim strPropValue
'*** 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_IndicationStaticValues"
strPropName = "MaxDisplayNotifications"
'*** Establish a connection to the DellOMCI namespace Set objWMIService =GetObject("winmgmts:{impersonationLevel=impersonate," &_ "AuthenticationLevel=pktprivacy}¥¥" & strComputerName & "¥" &_ strNameSpace)
'*** Retrieve the instances of '***Dell_IndicationStaticValues class (there should be 16 instances one for each alert type).
Set ColSystem=objWMIService.execquery ("Select * from " & strClassName)
For each objInstance in ColSystem
'*** Set the value of MaxDisplayNotifications to'0' '*** Set the new value for the property and save the instance objInstance.Properties_.Item(strPropName).Value = 0 objInstance.Put_ Next
'*** If any errors occurred, let the user know.
If Err.Number <> 0 Then
WScript.Echo "The change to the property failed."
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 /nologo SampleDisableAlertMessages.vbs <systemname>" WScript.Echo strMessage
'****************************************************
'*** Name: SampleShutdown.vbs '*** Purpose: To shut down a Dell OMCI client. '*** Usage: cscript.exe //nologo SampleShutdown.vbs <systemname> '*** '*** 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. '**************************************************** 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
'*** 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 "Method completed successfully." else WScript.Echo "Method failed." 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 //nologo SampleShutdown.vbs <systemname>" WScript.Echo strMessage
End Sub
'*** 変数の宣言 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 Call Usage() WScript.Quit End If
'*** シャットダウンメソッドの実行 Set ObjOutParam = objInstance.ExecMethod_(strMethod)
'*** メソッドが正常に実行されたかどうかをユーザーに通知する
'*** メモ: 戻り値が 0 の場合は、システムが
'*** シャットダウンしたのではなく、シャットダウンメソッドが正常に
'*** 開始したことを意味します。 If objOutParam.ReturnValue = 0 Then WScript.Echo "メソッドが正常に完了しました。" else WScript.Echo "メソッドが失敗しました。" End If
'*** スクリプトの正しい使用法を表示するために使用する Sub Sub Usage() Dim strMessage strMessage = "構文が正しくありません。次のように実行します:" & vbCRLF & _ "cscript.exe //nologo SampleShutdown.vbs <システム名>" WScript.Echo strMessage
End Sub)
リモートシステムの再起動
以下のサンプル VBScript は、リモートから Del OMCI クライアントを再起動します。
'**************************************************** '*** Name: SampleRestart.vbs '*** Purpose: To restart a Dell OMCI client. '*** Usage: cscript.exe //nologo SampleRestart.vbs <systemname> '*** '*** 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. '****************************************************
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
'*** 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 "Method completed successfully." else WScript.Echo "Method failed." 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 //nologo SampleRestart.vbs <systemname>" WScript.Echo strMessage End Sub
'*** 変数の宣言
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
Call Usage()
WScript.Quit
End If
'*** シャットダウンメソッドの実行
Set ObjOutParam = objInstance.ExecMethod_(strMethod)
'*** メソッドが正常に実行されたかどうかをユーザーに通知する
'*** メモ: 戻り値が 0 の場合は、システムが
'*** シャットダウンしたのではなく、シャットダウンメソッドが正常に
'*** 開始したことを意味します。
If objOutParam.ReturnValue = 0 Then
WScript.Echo "Method completed successfully."
else
WScript.Echo "Method failed."
End If
'*** スクリプトの正しい使用法を表示するために使用する Sub
Sub Usage()
Dim strMessage
strMessage = "incorrect syntax. You should run: " & vbCRLF & _
"cscript.exe //nologo SampleRestart.vbs <systemname>"
WScript.Echo strMessage
End Sub)
リモート BIOS のアップデート
以下のサンプル VBScript は、リモートから Del OMCI クライアントを再起動します。
'****************************************************
'*** Name: SampleFlash.vbs
'*** Purpose: To flash the BIOS of a Dell OMCI client.
'*** Usage: cscript.exe //nologo SampleFlash.vbs <systemname> <URL
'*** of BIOS header file>
'***
'*** 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.
'****************************************************
Option Explicit
'*** Declare variables
Dim strNameSpace
Dim strComputerName
Dim strClassName
Dim strPropValue
Dim objInstance
Dim ObjOutParam
Dim strMethod
Dim objMethod
Dim objClass
Dim objInParam
'*** 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 < 2) Then
Call Usage()
WScript.Quit
End If
'*** Retrieve the Dell_Configuration class
Set objClass = GetObject("WinMgmts:{impersonationLevel=impersonate}//" & _
strComputerName & "/" & strNameSpace & ":" & strClassName)
Set objMethod = objClass.Methods_(strMethod)
'*** Set the In parameter of the method to the URL of BIOS header file
Set objInParam = objMethod.inParameters.SpawnInstance_()
objInParam.sUrl = WScript.Arguments(1)
'*** Execute the method
Set ObjOutParam = objClass.ExecMethod_(strMethod, objInParam)
'*** Let the user know whether the method returned success or not
'*** Note: if return value is 0, it does not mean the system's BIOS has
'*** been flashed, it only means that the flash method was initiated
'*** successfully.
If objOutParam.ReturnValue = 0 Then
WScript.Echo "Method completed successfully."
else
WScript.Echo "Method failed."
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 //nologo SampleFlash.vbs <systemname> <URL of BIOS
header file>"
WScript.Echo strMessage
End Sub
'*** 変数の宣言
Dim strNameSpace
Dim strComputerName
Dim strClassName
Dim strPropValue
Dim objInstance
Dim ObjOutParam
Dim strMethod
Dim objMethod
Dim objClass
Dim objInParam
'*** スクリプトの実行に正しい実行ファイルが使用され、
'*** パラメータがすべて渡されたことを確認する
If (LCase(Right(WScript.FullName, 11)) = "wscript.exe" ) Or _
(Wscript.Arguments.Count < 2) Then
Call Usage()
WScript.Quit
End If
'*** メソッドの In パラメータを BIOS ヘッダーファイルの URL に設定する
Set objInParam = objMethod.inParameters.SpawnInstance_()
objInParam.sUrl = WScript.Arguments(1)
'*** メソッドの実行
Set ObjOutParam = objClass.ExecMethod_(strMethod, objInParam)
'*** メソッドが正常に実行されたかどうかをユーザーに通知する
'*** メモ: 戻り値が 0 の場合は、システムの BIOS が
'*** フラッシュされたのではなく、フラッシュメソッドが正常に
'*** 開始したことを意味します。
If objOutParam.ReturnValue = 0 Then
WScript.Echo "メソッドが正常に完了しました。"
else
WScript.Echo "メソッドが失敗しました。"
End If
'*** スクリプトの正しい使用法を表示するために使用する Sub
Sub Usage()
Dim strMessage
strMessage = "incorrect syntax. You should run: " & vbCRLF & _
"cscript.exe //nologo SampleFlash.vbs <systemname> <URL of BIOS
header file>"
WScript.Echo strMessage
End Sub)
'**************************************************** '*** Name: SampleForcePXE.vbs '*** Purpose: To force a Dell OMCI client to boot to PXE on next reboot. '*** Usage: cscript.exe //nologo SampleForcePXE.vbs <systemname> '*** '*** 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. '****************************************************
Option Explicit
'*** Declare variables Dim strNameSpace Dim strComputerName Dim strClassName Dim strKeyValue Dim objInstance Dim strPropName Dim strPropValue
'*** 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
'*** Set the new value for the property and save the instance, but only '*** if the current value is not already 3 ('Enabled') If strPropValue <> 3 Then objInstance.Properties_.Item(strPropName).Value = 3 objInstance.Put_
'*** If any errors occurred, let the user know If Err.Number <> 0 Then WScript.Echo "Setting PXE on next reboot failed." End If 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 //nologo SampleForcePXE.vbs <systemname>" WScript.Echo strMessage End Sub
'*** 変数の宣言 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 Call Usage() WScript.Quit End If
'*** 現在の値が既に 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 //nologo SampleForcePXE.vbs <システム名>" WScript.Echo strMessage End Sub)
Wakeup on LAN の有効化
以下のサンプル VBScript は、Dell OMCI クライアントで Wakeup oN LAN を有効にします。
'**************************************************** '*** Name: SampleWuOLEnable.vbs '*** Purpose: To enable Wakeup On LAN on a Dell OMCI client. '*** Usage: cscript.exe //nologo SampleWuOLEnable.vbs <systemname> '*** '*** 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. '****************************************************
Option Explicit
'*** Declare variables Dim strNameSpace Dim strComputerName Dim strClassName Dim strKeyValue Dim objInstance Dim strPropName Dim strPropValue
'*** 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_SMBIOSSettings" strKeyValue = "0" strPropName = "WakeupOnLan" '*** Retrieve the instance of Dell_SMBIOSSettings class (there should '*** only be 1 instance). Set objInstance = GetObject("WinMgmts:{impersonationLevel=impersonate}//" &_ strComputerName & "/" & strNameSpace & ":" & strClassName & "=" & _ Chr(34) & strKeyValue & Chr(34))
'*** Set the value of WakeUpOnLan only if it is not already '6' ("Enable '*** for all NICs") if strPropValue <> 6 then
'*** Set the new value for the property and save the instance objInstance.Properties_.Item(strPropName).Value = 6 objInstance.Put_
'*** If any errors occurred, let the user know If Err.Number <> 0 Then WScript.Echo "Enabling WakeUp On Lan failed." End If 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 //nologo SampleWuOLEnable.vbs <systemname>" WScript.Echo strMessage End Sub
'**************************************************** '*** Name: SampleSystemSummary.vbs '*** Purpose: To display asset tag, service tag, and BIOS revision of '*** a Dell OMCI client. '*** Usage: cscript.exe //nologo SampleSystemSummary.vbs <systemname> '*** '*** 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. '****************************************************
Option Explicit
'*** Declare variables Dim strNameSpace Dim strComputerName Dim strClassName Dim colInstances Dim objInstance Dim strWQLQuery Dim strMessage Dim strKeyName
'*** 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
'*** WQL Query to retrieve instances of Dell_SystemSummary strWQLQuery = "SELECT * FROM " & strClassName & " WHERE " & _ strKeyName & "=" & Chr(34) & strComputerName & Chr(34)
'*** Retrieve instances of Dell_Configuration class (there should only '*** be 1 instance). Set colInstances = GetObject("WinMgmts:{impersonationLevel=impersonate}//"&_ strComputerName & "/" & strNameSpace).ExecQuery(strWQLQuery, "WQL", NULL)
'*** Use only first instance to retrieve asset tag, service tag, and BIOS '*** version For Each objInstance in colInstances strMessage = "Asset Tag: " strMessage = strMessage & objInstance.Properties_.Item ("AssetTag").Value strMessage = strMessage & vbCRLF & "Service Tag: " strMessage = strMessage & objInstance.Properties_.Item ("ServiceTag").Value strMessage = strMessage & vbCRLF & "BIOS Version: " strMessage = strMessage & objInstance.Properties_.Item ("BIOSVersion").Value Exit For Next
'*** Display the results WScript.Echo strMessage
'*** Sub used to display the correct usage of the script Sub Usage() Dim strMessage strMessage = "incorrect syntax. You should run: " & vbCRLF & _ "cscript.exe //nologo SampleSystemSummary.vbs <systemname>" WScript.Echo strMessage End Sub
'*** 変数の宣言 Dim strNameSpace Dim strComputerName Dim strClassName Dim colInstances Dim objInstance Dim strWQLQuery Dim strMessage Dim strKeyName
'*** スクリプトの実行に正しい実行ファイルが使用され、 '*** パラメータがすべて渡されたことを確認する If (LCase(Right(WScript.FullName, 11)) = "wscript.exe" ) Or _ (Wscript.Arguments.Count < 1) Then Call Usage() WScript.Quit End If
'**************************************************** '*** Name: SampleBIOSPwd.vbs '*** Purpose: To change the BIOS password on a Dell OMCI client. '*** Usage: cscript.exe //nologo SampleBIOSPwd.vbs <systemname> "<old '*** pwd> space <new pwd>" '*** '*** 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. '****************************************************
'*** Declare variables Dim strNameSpace Dim strComputerName Dim strClassName Dim strKeyValue Dim objInstance Dim strPropName Dim strPwd
'*** Check that the right executable was used to run the script '*** and that all parameters were passed If (LCase(Right(WScript.FullName, 11)) <> "cscript.exe" ) Or _ (Wscript.Arguments.Count < 2) Then Call Usage() WScript.Quit End If
'*** Retrieve the instance of Dell_Configuration class (there should '*** only be 1 instance). Set objInstance = GetObject("WinMgmts:{impersonationLevel=impersonate}//" &_ strComputerName & "/" & strNameSpace & ":" & strClassName & "=" & _ Chr(34) & strKeyValue & Chr(34))
'*** Set the new value for the property and save the instance objInstance.Properties_.Item(strPropName).Value = strPwd objInstance.Properties_.Item(strPassEncryptPropName).Value = 0 objInstance.Put_
'*** If any errors occurred, let the user know If Err.Number <> 0 Then WScript.Echo "Setting the BIOS password failed." 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 //nologo SampleBIOSPwd.vbs <systemname> " & Chr(34) & _ "<old pwd> space <new pwd>" & Chr(34) WScript.Echo strMessage End Sub
'*** 変数の宣言 Dim strNameSpace Dim strComputerName Dim strClassName Dim strKeyValue Dim objInstance Dim strPropName Dim strPwd
'*** スクリプトの実行に正しい実行ファイルが使用され、 '*** パラメータがすべて渡されたことを確認する If (LCase(Right(WScript.FullName, 11)) <> "cscript.exe" ) Or _ (Wscript.Arguments.Count < 2) Then Call Usage() WScript.Quit End If