Hi guys,
Here is a small function I wrote to gather basic informations arround the Operating System product.
[ps]Function Get-ComputerSystemProductInfo {
<#
.SYNOPSIS
Query WMI of the system to provide basic information of the Operating System product.
.PARAMETER ComputerName
The computer name or IP of targeted computer.
.NOTES
Author: Thomas Prud’homme (Twitter: @prudhommewtf).
.LINK
https://blog.prudhomme.wtf/powershell-querying-operating-system-product-informations
#>
[CmdletBinding()]
Param(
[String]$ComputerName = $env:COMPUTERNAME
)
Begin {
# Win32_ComputerSystemProduct: http://msdn.microsoft.com/en-us/library/aa394105(VS.85).aspx
$Win32_ComputerSystemProduct = Get-WMIObject -Namespace root\CIMV2 -Class Win32_ComputerSystemProduct -Property Vendor, Name, IdentifyingNumber, Version -ComputerName $ComputerName
}
Process {
Write-Verbose -Message ‘Computer System Product gathered information:’
$Output = @()
$Win32_ComputerSystemProduct | ForEach-Object {
$ComputerSystemProductInformation = New-Object -TypeName PSObject -Property @{
Manufacturer = $_.Vendor
Name = $_.Name
IdentifyingNumber = $_.IdentifyingNumber
Version = $_.Version
}
$ComputerSystemProductInformation.psobject.Properties | ForEach-Object {
Write-Verbose -Message "`t$($_.Name): $($_.Value)"
}
$Output += $ComputerSystemProductInformation
}
}
End {
Write-Output -InputObject $Output
}
}[/ps]
See you,