-
Notifications
You must be signed in to change notification settings - Fork 94
/
Copy pathGet-SKU.ps1
24 lines (22 loc) · 873 Bytes
/
Get-SKU.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
## INFO
# get SystemSKU of remote computer
# (gwmi -n root\wmi ms_systeminformation).systemsku
function Get-SKU {
param (
[object]$comps = $env:COMPUTERNAME
)
foreach ($computer in $comps) {
try {
# (gp 'HKLM:\HARDWARE\DESCRIPTION\System\BIOS').SystemSku
# reg query \\$computer\HKLM\HARDWARE\DESCRIPTION\System\BIOS /v SystemSku
[Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine',$computer).OpenSubKey('HARDWARE\DESCRIPTION\System\BIOS').GetValue('SystemSku')
} catch {
try {
# WMIC /NODE: "`"$computer"`" /NAMESPACE:\\root\wmi path MS_SystemInformation
(Get-WMIObject -Namespace root\wmi -Class MS_SystemInformation -ComputerName $computer).SystemSKU
} catch {
return 'Error'
}
}
}
}