19. april 2005 - 12:22
Der er
1 kommentar og
1 løsning
Dell's Asset Tag
Vi har købt en del Dell pc'er i vores virksomhed, ca 500 stk.
Da vi lægger image på pc'erne ret tit, kunne jeg godt tænke mig at jeg kunne trække pc-navnet ud af maskinen (det ligger i Asset Tag'et)
Er der nogen her, som har ved hvordan dette kan gøres ?
19. april 2005 - 12:39
#1
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
'*** Initialize variables
strNameSpace = "root/Dellomci"
strComputerName = WScript.Arguments(0)
strClassName = "Dell_SystemSummary"
strKeyName = "Name"
'*** 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
19. april 2005 - 14:13
#2
Fandt selv løsningen :)
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