Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HumanEquivalentUnit/4d59394f8601f49ec8e4bce201e03ecc to your computer and use it in GitHub Desktop.
Save HumanEquivalentUnit/4d59394f8601f49ec8e4bce201e03ecc to your computer and use it in GitHub Desktop.
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" }
} } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment