Avatar billede deploymentgeek Nybegynder
28. september 2006 - 14:04 Der er 1 kommentar

Brug af vbs til info om hardware

Hejsa

Jeg ved det er muligt via vbs og wmi og crawle info om hardware i maskinen. jeg ville høre om det er muligt eks. og få af vide hvilket motherboard er der i maskinen, netkort, grafikkort, og udover det vil jeg også gerne have Serienummeret på det. kan det lade sig gøre ?
Avatar billede nestle Nybegynder
26. marts 2007 - 10:29 #1
Hej Jeg har dette script det burde kunne gøre det for dig:

On Error Resume Next
Dim objWMI : Set objWMI = GetObject("winmgmts:")
Dim colMotherboard : Set colMotherboard = objWMI.ExecQuery("Select * from Win32_BaseBoard")
Dim colSettingsSys : Set colSettingsSys = objWMI.ExecQuery("Select Vendor, Name, IdentifyingNumber from Win32_ComputerSystemProduct")
Dim colSettingsComp : Set colSettings = objWMI.ExecQuery("Select * from Win32_ComputerSystem")
Dim colSettingsBios : Set colSettingsBios = objWMI.ExecQuery("Select * from Win32_BIOS")
Dim colBattery : Set colBattery = objWMI.ExecQuery("Select * from Win32_Battery")
Dim colItems : Set colItems = objWMI.ExecQuery("Select Caption, CSDVersion, InstallDate, OSLanguage, Version, WindowsDirectory from Win32_OperatingSystem")
Dim WshNetwork : Set WshNetwork = WScript.CreateObject("WScript.Network")
Dim objComputer, objItem, strModel, strSerial, strComputerSystemProduct_Battery, strOperatingSystem_Caption, strOperatingSystem_ServicePack, strComputerSystemProduct_Manufacturer
Dim strComputerSystem_Name, strComputerSystem_Domain, strLastUser, StrMotherboard


For Each objItem in colMotherboard
    StrMotherboard = objItem.Manufacturer
Next


For Each objItem in colSettingsSys
  strComputerSystemProduct_Manufacturer = objItem.Vendor
  strComputerSystemProduct_Name = objItem.Name
  strComputerSystemProduct_IdentifyingNumber = objItem.IdentifyingNumber
Next

For Each objComputer in colSettings
  strModel = objComputer.Model
Next

For Each objItem in colSettings
  strComputerSystem_Domain = objItem.Domain
  nComputerSystem_DomainRole = objItem.DomainRole
  strComputerSystem_Name = objItem.Name
Next

For Each objComputer in colSettingsBios
  strSerial = objComputer.SerialNumber
Next

For Each objBattery In colBattery
  strComputerSystemProduct_Battery = objBattery.DeviceID
Next

For Each objItem in colItems
  strOperatingSystem_InstallDate = objItem.InstallDate
  strOperatingSystem_Caption = objItem.Caption
  strOperatingSystem_ServicePack = objItem.CSDVersion
  strOperatingSystem_LanguageCode = Clng(objItem.OSLanguage)
  strOperatingSystem_LanguageCode = Hex(strOperatingSystem_LanguageCode)
  nOperatingSystemLevel = objItem.Version
  strOperatingSystem_WindowsDirectory = objItem.WindowsDirectory
Next


strOutputFile = "c:\hardware.txt"

Set objFileSystem = CreateObject("Scripting.fileSystemObject")

Set objOutputFile = objFileSystem.CreateTextFile(strOutputFile, TRUE)

objOutputFile.WriteLine "fqdn " & strComputerSystem_Name & "." & strComputerSystem_Domain
objOutputFile.WriteLine "Vendor " & strComputerSystemProduct_Manufacturer
objOutputFile.WriteLine "model " & strModel
objOutputFile.WriteLine "serienr " & strserial
objOutputFile.WriteLine "Batteri s/n" & strComputerSystemProduct_Battery
objOutputFile.WriteLine "OS " & strOperatingSystem_Caption
objOutputFile.WriteLine "SP " & strOperatingSystem_ServicePack
objOutputFile.WriteLine "Brugernavn " & WshNetwork.UserName
objOutputFile.WriteLine "MotherBoard " & StrMotherboard

Set objWMI = Nothing
Set colMotherboard = Nothing
Set colSettings = Nothing
Set colSettingsBios = Nothing
Set colItems = Nothing
Set objFileSystem = Nothing
Set objOutputFile = Nothing
Set colBattery = Nothing
Set colSettingsSys = Nothing
Set objRegLocator = Nothing
Set objRegService = Nothing
Set oReg = Nothing
Avatar billede Ny bruger Nybegynder

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.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester