Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for bios.ps

(view source code of bios.ps as plain text)

  1. <#
  2. .SYNOPSIS
  3. List all properties and values of the Win32_BIOS class in WMI's root/cimv2 namespace
  4.  
  5. .DESCRIPTION
  6. This PowerShell 7 script was generated using WMIGen (formerly known as WMI Code Generator), Version 10.0.15.0 and then trimmed manually.
  7. WMIGen's PowerShell template script was updated to PowerShell 7 by Thierry Montané.
  8. It queries WMI to list all properties and values of the Win32_BIOS class in the root/cimv2 namepace, for the local or a remote computer.
  9.  
  10. .PARAMETER Computer
  11. The optional name of a remote computer to be queried.
  12. If not specified, the local computer will be queried.
  13.  
  14. .LINK
  15. WMIGen multi-language code generator by Rob van der Woude
  16. https://www.robvanderwoude.com/wmigen.php
  17. #>
  18.  
  19. param( [string]$Computer = "." )
  20.  
  21. if ( $computer -eq "." ) {
  22. 	$instances = Get-CimInstance -ClassName "Win32_BIOS" -Namespace "root/cimv2"
  23. } else {
  24. 	$instances = Get-CimInstance -ClassName "Win32_BIOS" -Namespace "root/cimv2" -ComputerName "$Computer"
  25. }
  26.  
  27. $count = ( $instances | Measure-Object ).Count
  28. if ( $count -eq 1 ) {
  29. 	Write-Host "1 instance:"
  30. } else {
  31. 	Write-Host "$count instances:"
  32. }
  33. Write-Host
  34.  
  35. foreach ($objItem in $colItems) {
  36. 	write-host "Name                           :" $objItem.Name
  37. 	write-host "Version                        :" $objItem.Version
  38. 	write-host "Manufacturer                   :" $objItem.Manufacturer
  39. 	write-host "SMBIOSBIOS Version             :" $objItem.SMBIOSBIOSVersion
  40. 	write-host
  41. }
  42.  

page last uploaded: 2021-01-27, 16:12