Scripts/Get-PCMotherboard.ps1
Function Get-PCMotherboard { <# .SYNOPSIS Get motherboard information .DESCRIPTION Get motherboard information .PARAMETER ComputerName The target computer name .EXAMPLE Get-PCMotherboard -ComputerName LabPC2024 .NOTES N/A .LINK N/A #> [CmdletBinding ()] Param ( [Parameter (Mandatory = $True, ValueFromPipeline = $True, ValueFromPipelineByPropertyName = $True, HelpMessage = 'Enter computer name' ) ] [String[]]$ComputerName ) BEGIN { Function Show-Output ($Computer, $Values, $Status) { [PSCustomObject]@{ ComputerName = $Computer Caption = $Values.Caption Description = $Values.Description HostingBoard = $Values.HostingBoard HotSwappable = $Values.HotSwappable Manufacturer = $Values.Manufacturer Model = $Values.Model Product = $Values.Product Removable = $Values.Removeable Replaceable = $Values.Replaceable RequiresDaughterBoard = $Values.RequiresDaughterBoard SerialNumber = $Values.SerialNumber Version = $Values.Version Status = $Status } } } PROCESS { ForEach ($Computer In $ComputerName) { If (Test-Connection -ComputerName $Computer -Count 1 -Quiet) { Try { $Data = Get-WmiObject Win32_Baseboard -ComputerName $Computer| Select-Object * Show-Output $Computer.ToUpper() $Data 'Ok' } Catch { Show-Output $Computer.ToUpper() $Null $PSItem.Exception.Message } } Else { Show-Output $Computer.ToUpper() $Null 'Unreachable' } } } END {} } |