Hi Guys,
I will start a small blog post serie with PowerShell functions I wrote that query WMI of remote computer. Here is the first function:
Function Get-BIOSInfo {
<#
.SYNOPSIS
Describe purpose of "Get-BIOSInfo" in 1-2 sentences.
.DESCRIPTION
Add a more complete description of what the function does.
.PARAMETER ComputerName
Describe parameter -ComputerName.
.EXAMPLE
Get-BIOSInfo -ComputerName Value
Describe what this call does
.NOTES
Author: Thomas Prud'homme (Twitter: @prudhommewtf).
.LINK
https://blog.prudhomme.wtf/powershell-wmi-querying-bios-informations
#>
[CmdletBinding()]
Param(
[String]$ComputerName = $env:COMPUTERNAME
)
Begin {
# Win32_BIOS: http://msdn.microsoft.com/en-us/library/aa394077(VS.85).aspx
$Win32_BIOS = Get-WmiObject -Namespace root\CIMV2 -Class Win32_BIOS -Property BiosCharacteristics, SMBIOSBIOSVersion, SMBIOSMajorVersion, SMBIOSMinorVersion, Version -ComputerName $ComputerName
}
Process {
Write-Verbose -Message 'BIOS gathered information:'
$Output = @()
$Win32_BIOS | ForEach-Object {
$BIOSInfo = New-Object -TypeName PSObject -Property @{
SMBIOSBIOSVersion = $_.SMBIOSBIOSVersion
SMBIOSMajorVersion = $_.SMBIOSMajorVersion
SMBIOSMinorVersion = $_.SMBIOSMinorVersion
Version = $_.Version
BiosCharacteristics = $_.BiosCharacteristics | ForEach-Object -Process { Invoke-BIOSCharacteristic -BIOSCharacteristic $_ }
}
$BIOSInfo.psobject.Properties | ForEach-Object {
Write-Verbose -Message "`t$($_.Name): $($_.Value)"
}
$Output += $BIOSInfo
}
}
End {
Write-Output -InputObject $Output
}
}
This function will provide you basic information over the BIOS configuration of the computer you want to query.
For the purpose of this script I used another function I wrote to match the BIOS Charactics integer with features names or configuration, you can find it there.
See you,
PowerShell WMI – Matching Function – BIOS Characteristics – Thomas Prud'homme
May 29, 2017 at 10:48 am[…] This function is used in the function to gather informations of the BIOS configuration with WMI. […]