Scripts/Get-PCBIOS.ps1
Function Get-PCBIOS { <# .SYNOPSIS Get BIOS information/configuration .DESCRIPTION Get BIOS information/configuration .PARAMETER ComputerName The target computer name .EXAMPLE Get-PCBIOS -ComputerName LabPC2024 .NOTES N/A .LINK N/A #> [CmdletBinding ()] Param ( [Parameter (Mandatory = $True, ValueFromPipeline = $True, ValueFromPipelineByPropertyName = $True, HelpMessage = 'Enter computer name' ) ] [String[]]$ComputerName, [Switch]$IncludeBIOSCharacteristics ) BEGIN { $BIOSCharacteristics = @{ '0' = 'Reserved' '1' = 'Reserved' '2' = 'Unknown' '3' = 'BIOS characteristics not Supported' '4' = 'ISA is supported' '5' = 'MCA is supported' '6' = 'EISA is supported' '7' = 'PCI is supported' '8' = 'PC Card (PCMCIA) is supported' '9' = 'Plug and Play is supported' '10' = 'APM is supported' '11' = 'BIOS is upgradable (Flash)' '12' = 'BIOS shadowing is allowed' '13' = 'VL-VESA is supported' '14' = 'ESCD support is available' '15' = 'Boot from CD is supported' '16' = 'Selectable boot is supported' '17' = 'BIOS ROM is socketed' '18' = 'Boot from PC card (PCMCIA) is supported' '19' = 'EDD (Enhanced Disk Drive) specification is supported' '20' = 'Int 13h - Japanese floppy for NEC 9800 1.2mb (3.5, 1k Bytes/sector, 360 RPM) is supported' '21' = 'Int 13h - Japanese floppy for Toshiba 1.2mb (3.5, 360 RPM) is supported' '22' = 'Int 13h - 5.25/360 KB floppy services are supported' '23' = 'Int 13h - 5.25/1.2MB floppy services are supported' '24' = 'Int 13h - 3.5/720 KB floppy services are supported' '25' = 'Int 13h - 3.5/2.88 MB floppy services are supported' '26' = 'Int 5h, Print Screen service is supported' '27' = 'Int 9h, 8042 Keyboard services are supported' '28' = 'Int 14h, Serial services are supported' '29' = 'Int 17h, Printer services are supported' '30' = 'Int 10h, CGA/Mono video services are supported' '31' = 'NEC PC-98' '32' = 'ACPI is supported' '33' = 'USB legacy is supported' '34' = 'AGP is supported' '35' = 'I2O boot is supported' '36' = 'LS-120 boot is supported' '37' = 'ATAPI ZIP drive boot is supported' '38' = '1394 boot is supported' '39' = 'Smart battery is supported' } Function Show-Error ($Computer, $Status) { [PSCustomObject]@{ ComputerName = $Computer Caption = '' Description = '' Manufacturer = '' PrimaryBIOS = '' ReleaseDate = '' SerialNumber = '' Version = '' Status = $Status } } } PROCESS { ForEach ($Computer In $ComputerName) { If (Test-Connection -ComputerName $Computer -Count 1 -Quiet) { Try { $OutputObj = New-Object -TypeName PSObject $Data = Get-WmiObject Win32_BIOS -ComputerName $Computer | Select-Object * [Object]$DateTime = [System.Management.ManagementDateTimeConverter]::ToDateTime($Data.ReleaseDate).ToUniversalTime() $OutputObj | Add-Member -MemberType NoteProperty -Name ComputerName -Value $Computer.ToUpper() $OutputObj | Add-Member -MemberType NoteProperty -Name Caption -Value $Data.Caption $OutputObj | Add-Member -MemberType NoteProperty -Name Description -Value $Data.Description $OutputObj | Add-Member -MemberType NoteProperty -Name Manufacturer -Value $Data.Manufacturer $OutputObj | Add-Member -MemberType NoteProperty -Name PrimaryBIOS -Value $Data.PrimaryBIOS $OutputObj | Add-Member -MemberType NoteProperty -Name ReleaseDate -Value $DateTime $OutputObj | Add-Member -MemberType NoteProperty -Name SerialNumber -Value $Data.SerialNumber $OutputObj | Add-Member -MemberType NoteProperty -Name Version -Value $Data.Version If ($IncludeBIOSCharacteristics) { ForEach ($Item In $Data.BIOSCharacteristics) { $OutputObj | Add-Member -MemberType NoteProperty -Name "$('Characteristic_')$($Item)" -Value $BIOSCharacteristics["$Item"] -Force If ($Item -ge 40 -and $Item -le 47) { $OutputObj | Add-Member -MemberType NoteProperty -Name "$('Characteristic_')$($Item)" -Value 'Reserved for BIOS vendor' -Force } If ($Item -ge 48 -and $Item -le 63) { $OutputObj | Add-Member -MemberType NoteProperty -Name "$('Characteristic_')$($Item)" -Value 'Reserved for system vendor' -Force } } } $OutputObj | Add-Member -MemberType NoteProperty -Name Status -Value 'Ok' Write-Output $OutputObj } Catch { Show-Error $Computer.ToUpper() $PSItem.Exception.Message } } Else { Show-Error $Computer.ToUpper() 'Unreachable' } } } END {} } |