Category published:  Deployment Scripting W10 WMI   Click on the Category button to get more articles regarding that product.

Script: WMI Fetch modell BIOS Version with VB OR PS like SM_info from Dell

Posted by admin on 24.10.2010

Please notice that Microsoft REMOVED VBSCRIPT Support in Windows PE MDT/SCCM or whatever you use in summer 2023. You may use other script language like PS. See last entry here.

The “sm_info” from Dell does not work on most new machines and under Windows PE 2.X/3.0 so you will have to use VB/WMI to get the machine type

‘ ‘ GET Model by Butsch Informatik, 2015
strComputer = “.”
Set objWMIService = GetObject(“winmgmts:\\” & strComputer &”\root\CIMV2″)
Set win32_colItems = objWMIService.ExecQuery(“SELECT * FROM Win32_ComputerSystem”,,48)
Set bios_colItems = objWMIService.ExecQuery(“SELECT * FROM Win32_BIOS”,,48)

For Each win32_objItem in win32_colItems
Wscript.Echo “Name: ” & win32_objItem.name
Wscript.Echo “Model: ” & win32_objItem.Model
Wscript.Echo “Manufacturer: ” & win32_objItem.Manufacturer
Next

For Each bios_objItem in bios_colItems
Wscript.Echo “Serial: ” & bios_objItem.Serialnumber
Next

Save above as bios.vbs

Then in a batch File you check the machine AND based on that you do certain things or install software which you can’t install silent.

cscript.exe //NOLOGO c:\windows\system32\bios.vbs | find “8510”
if %errorlevel%==0 goto 8510

cscript.exe //NOLOGO c:\windows\system32\bios.vbs | find “6710”
if %errorlevel%==0 goto 6710

cscript.exe //NOLOGO c:\windows\system32\bios.vbs | find “6120”
if %errorlevel%==0 goto 6120

:8510
echo “This is HP 8550”
goto ende

:ende

 

Powershell Version:
PowerShell script to get computer information
$computer = “.”
Get computer system information
$win32_colItems = Get-WmiObject -Class Win32_ComputerSystem -ComputerName $computer
foreach ($win32_objItem in $win32_colItems) {
Write-Host “Name: $($win32_objItem.Name)”
Write-Host “Model: $($win32_objItem.Model)”
Write-Host “Manufacturer: $($win32_objItem.Manufacturer)”
}
Get BIOS information
$bios_colItems = Get-WmiObject -Class Win32_BIOS -ComputerName $computer
foreach ($bios_objItem in $bios_colItems) {
Write-Host “Serial: $($bios_objItem.Serialnumber)”
}

 Category published:  Deployment Scripting W10 WMI   Click on the Category button to get more articles regarding that product.