Last active
September 18, 2019 14:17
-
-
Save opariffazman/70fc618acafb88749da8d73a4acf20c4 to your computer and use it in GitHub Desktop.
Show off your PC specs!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get-specs { | |
Write-Output "`n" | |
Write-Verbose -Message "Acquiring Computer Specification" -Verbose | |
# Build Main Info | |
$Info = { } | Select-Object Motherboard, CPU, Socket, GPU, Monitor, Resolution | |
$Info.Motherboard = ((Get-CimInstance Win32_Baseboard).Manufacturer).Split(" ")[0] + ' ' + (Get-CimInstance win32_baseboard).Product | |
$Info.CPU = ((Get-WmiObject Win32_Processor).Name).trim() + ' @ ' + (Get-WmiObject Win32_Processor).MaxClockSpeed + ' MHz' | |
$Info.Socket = (Get-WmiObject Win32_Processor).SocketDesignation | |
$Info.GPU = (Get-WmiObject Win32_VideoController).Name | |
$Info.Monitor = Get-WmiObject WmiMonitorID -Namespace root\wmi | ForEach-Object { ($_.UserFriendlyName -ne 0 | ForEach-Object { [char]$_ }) -join "" } | |
# Build Monitor Info | |
$resX = ((Get-WmiObject Win32_VideoController).CurrentHorizontalResolution).ToString() | |
$resY = ((Get-WmiObject Win32_VideoController).CurrentVerticalResolution).ToString() | |
$refreshRate = (Get-WmiObject Win32_VideoController).CurrentRefreshRate.ToString() | |
$Info.Resolution = "$resX x $resY @ $refreshRate Hz" | |
# Build Memory Info | |
$memoryInfo = @() | |
foreach ($mem in (Get-WmiObject Win32_PhysicalMemory)) { | |
$memInfo = { } | Select-Object Channel, DeviceLocator, Manufacturer, Capacity, CasLatency , SKU | |
$memInfo.Channel = $mem.BankLabel | |
$memInfo.DeviceLocator = $mem.DeviceLocator | |
# Manufacturer switch based on PartNumber | |
switch ($mem.PartNumber.Substring(0, 2)) { | |
'AX' { $memManufacturer = "Adata" } | |
'CM' { $memManufacturer = "Corsair" } | |
'F4' { $memManufacturer = "G.Skill" } | |
'HX' { $memManufacturer = "Kingston Hyper X" } | |
'P' { $memManufacturer = "Patriot" } | |
'T' { $memManufacturer = "Team" } | |
Default { $memManufacturer = "Unknown" } | |
} | |
$memInfo.Manufacturer = $memManufacturer | |
$memInfo.Capacity = ($mem.Capacity / 1GB).ToString() + 'GB @ ' + $mem.Speed + ' MHz' | |
$memInfo.CasLatency = $mem.PartNumber.split("C")[1].Substring(0, 2) | |
$memInfo.SKU = $mem.PartNumber | |
$memoryInfo += $memInfo | |
} | |
$Info | |
$memoryInfo | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment