-
Notifications
You must be signed in to change notification settings - Fork 0
/
Get-SHDComputerBios.ps1
26 lines (26 loc) · 1.14 KB
/
Get-SHDComputerBios.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function Get-SHDComputerBios {
[cmdletbinding()]
param (
[Parameter(
ValueFromPipeline = $True,
ValueFromPipelineByPropertyName = $True,
HelpMessage = "Provide the target hostname",
Mandatory = $true)][Alias('Hostname', 'cn')][String[]]$Computername,
[Parameter(HelpMessage = "Allows for custom Credential.")][System.Management.Automation.PSCredential]$Credential
)$parameters = @{
ComputerName = $ComputerName
ScriptBlock = {
try {
Get-CimInstance -ClassName win32_bios
} Catch {
try {
get-wmiobject -class win32_bios
} catch {
Write-Warning "Failed to capture bios info from $($env:COMPUTERNAME)"
}
}
}
}
if ($PSBoundParameters.ContainsKey('Credential')) { $parameters += @{Credential = $Credential } }
Invoke-Command @parameters | sort-object pscomputername | Select-Object pscomputername, name, manufacturer, SMBIOSBIOSVersion, Version, serialnumber
} #review - Order,testing,Documentation