PS C:\Users\NoelAsus> $wmiObj = New-Object System.Management.ManagementClass SoftwareLicensingProduct
PS C:\Users\NoelAsus> $LicenseStats = @("Unlicensed", "Licensed", "OOBGrace", "OOTGrace", "NonGenuineGrace", "Notificati
on", "ExtendedGrace")
PS C:\Users\NoelAsus> foreach($p in $wmiObj.GetInstances())
>> {
>> "Name: {0}" -f $p.Name
>> "GenuineStatus: {0}" -f ($p.GenuineStatus -eq 0)
>> "LicenseStatus: {0}" -f $LicenseStats[$p.LicenseStatus]
>> "PartialProductKey: {0}" -f $p.PartialProductKey
>> "ProductKeyID: {0}" -f $p.ProductKeyID
>> "ValidationURL: {0}" -f $p.ValidationURL
>> "--------------------------------`n"
>> }
>>
Name: Windows(R) 7, HomePremium edition
GenuineStatus: True
LicenseStatus: Unlicensed
PartialProductKey:
ProductKeyID:
ValidationURL:
--------------------------------
Name: Windows(R) 7, HomePremium edition
GenuineStatus: True
LicenseStatus: Unlicensed
PartialProductKey:
ProductKeyID:
ValidationURL:
--------------------------------
Name: Windows(R) 7, HomePremium edition
GenuineStatus: True
LicenseStatus: Unlicensed
PartialProductKey:
ProductKeyID:
ValidationURL:
--------------------------------
Name: Windows(R) 7, OCUR add-on for Ultimate,HomePremium,Enterprise,Professional,ServerHomePremium,Embedded
GenuineStatus: True
LicenseStatus: Unlicensed
PartialProductKey:
ProductKeyID:
ValidationURL:
--------------------------------
Name: Windows(R) 7, HomePremium edition
GenuineStatus: True
LicenseStatus: Unlicensed
PartialProductKey:
ProductKeyID:
ValidationURL:
--------------------------------
Name: Windows(R) 7, HomePremium edition
GenuineStatus: True
LicenseStatus: Unlicensed
PartialProductKey:
ProductKeyID:
ValidationURL:
--------------------------------
Name: Windows(R) 7, HomePremium edition
GenuineStatus: True
LicenseStatus: Unlicensed
PartialProductKey:
ProductKeyID:
ValidationURL:
--------------------------------
Name: Windows(R) 7, HomePremium edition
GenuineStatus: True
LicenseStatus: Unlicensed
PartialProductKey:
ProductKeyID:
ValidationURL:
--------------------------------
Name: Windows(R) 7, HomePremium edition
GenuineStatus: True
LicenseStatus: Unlicensed
PartialProductKey:
ProductKeyID:
ValidationURL:
--------------------------------
Name: Windows(R) 7, HomePremium edition
GenuineStatus: True
LicenseStatus: Unlicensed
PartialProductKey:
ProductKeyID:
ValidationURL:
--------------------------------
Name: Windows(R) 7, HomePremium edition
GenuineStatus: True
LicenseStatus: Unlicensed
PartialProductKey:
ProductKeyID:
ValidationURL:
--------------------------------
Name: Windows(R) 7, OCUR add-on for Ultimate,HomePremium,Enterprise,Professional,ServerHomePremium,Embedded
GenuineStatus: True
LicenseStatus: Unlicensed
PartialProductKey:
ProductKeyID:
ValidationURL:
--------------------------------
Name: Windows(R) 7, HomePremium edition
GenuineStatus: True
LicenseStatus: Unlicensed
PartialProductKey:
ProductKeyID:
ValidationURL:
--------------------------------
Name: Windows(R) 7, HomePremium edition
GenuineStatus: True
LicenseStatus: Licensed
PartialProductKey: 9YQTR
ProductKeyID: 00359-00178-926-800007-02-1033-7600.0000-2092009
ValidationURL:
--------------------------------
Name: Windows(R) 7, HomePremium edition
GenuineStatus: True
LicenseStatus: Unlicensed
PartialProductKey:
ProductKeyID:
ValidationURL:
--------------------------------
Name: Windows(R) 7, HomePremium edition
GenuineStatus: True
LicenseStatus: Unlicensed
PartialProductKey:
ProductKeyID:
ValidationURL:
--------------------------------
PS C:\Users\NoelAsus> $wmiObj = New-Object System.Management.ManagementClass SoftwareLicensingProduct
PS C:\Users\NoelAsus> $wmiProperties = $wmiObj.Properties
PS C:\Users\NoelAsus> "{0} Properties:`n" -f $wmiProperties.count
44 Properties:
PS C:\Users\NoelAsus>
PS C:\Users\NoelAsus> foreach ($obj in $wmiProperties)
>> {
>> "`tProperty Name: {0}" -f $obj.Name
>> }
>>
Property Name: ApplicationID
Property Name: Description
Property Name: DiscoveredKeyManagementServiceMachineName
Property Name: DiscoveredKeyManagementServiceMachinePort
Property Name: EvaluationEndDate
Property Name: ExtendedGrace
Property Name: GenuineStatus
Property Name: GracePeriodRemaining
Property Name: ID
Property Name: IsKeyManagementServiceMachine
Property Name: KeyManagementServiceCurrentCount
Property Name: KeyManagementServiceFailedRequests
Property Name: KeyManagementServiceLicensedRequests
Property Name: KeyManagementServiceMachine
Property Name: KeyManagementServiceNonGenuineGraceRequests
Property Name: KeyManagementServiceNotificationRequests
Property Name: KeyManagementServiceOOBGraceRequests
Property Name: KeyManagementServiceOOTGraceRequests
Property Name: KeyManagementServicePort
Property Name: KeyManagementServiceProductKeyID
Property Name: KeyManagementServiceTotalRequests
Property Name: KeyManagementServiceUnlicensedRequests
Property Name: LicenseDependsOn
Property Name: LicenseFamily
Property Name: LicenseIsAddon
Property Name: LicenseStatus
Property Name: LicenseStatusReason
Property Name: MachineURL
Property Name: Name
Property Name: OfflineInstallationId
Property Name: PartialProductKey
Property Name: ProcessorURL
Property Name: ProductKeyID
Property Name: ProductKeyURL
Property Name: RequiredClientCount
Property Name: TokenActivationAdditionalInfo
Property Name: TokenActivationCertificateThumbprint
Property Name: TokenActivationGrantNumber
Property Name: TokenActivationILID
Property Name: TokenActivationILVID
Property Name: TrustedTime
Property Name: UseLicenseURL
Property Name: VLActivationInterval
Property Name: VLRenewalInterval
PS C:\Users\NoelAsus>