Har prøvet flg. script fra Dell's hjemmeside men komme med en fejl ved flg. linje Set colInstances = GetObject("WinMgmts:{impersonationLevel=impersonate}//" & strComputerName & "/" & strNameSpace).ExecQuery(strWQLQuery, "WQL", NULL)
'****************************************************************************************** '*** 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
strComputer = "." Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colSMBIOS = objWMIService.ExecQuery ("Select * from Win32_SystemEnclosure") For Each objSMBIOS in colSMBIOS If objSMBIOS.SMBIOSAssetTag = "" Then Else Wscript.Echo "Asset Tag: " & objSMBIOS.SMBIOSAssetTag End if Next
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.