Skip to content

Instantly share code, notes, and snippets.

@HumanEquivalentUnit
HumanEquivalentUnit / gist:4d59394f8601f49ec8e4bce201e03ecc
Created November 23, 2017 19:37
Get Windows activation status, taken from slmgr.vbs and ignoring KMS and AD and other product licensing, and older versions.
Get-CimInstance -ClassName SoftwareLicensingProduct |
Where-Object {$_.ApplicationId -eq "55c92734-d682-4d71-983e-d6ec3f16059f" -and $_.PartialProductKey } |
Select-Object Name,
@{Name="LicenseStatus"; Expression = {
switch ($_.LicenseStatus) { 0 { "Unactivated"}
1 { "Activated" }
default { "unknown" }
} } }