yosi
yosi

Reputation: 75

Check if Windows is activeted via wmi filter

I want to get a message if Windows not activated

I create gpo that run message on logon

If i run this filter via wmi filter Get-wmiobject -query 'select licensestatus from softwarelicensingproduct where LicenseStatus like 1'

I get the message.

But if run this filter Get-wmiobject -query 'select licensestatus from softwarelicensingproduct where LicenseStatus like 0'

I get message on all the computers - activate and not activate

Is it possible to check all computers where the where LicenseStatus like 1 does not work?

I try to write this with not like

Get-wmiobject -query 'select licensestatus from softwarelicensingproduct where not LicenseStatus like 1'

It is not work. its work like LicenseStatus like 0

Upvotes: 0

Views: 1894

Answers (2)

I came up with a GPO WMI filter for clients with activation SELECT LicenseStatus FROM SoftwareLicensingProduct WHERE Name LIKE "%Windows%" AND PartialProductKey IS NOT NULL AND LicenseStatus =1 For windows clients without activation SELECT LicenseStatus FROM SoftwareLicensingProduct WHERE Name LIKE "%Windows%" AND PartialProductKey IS NOT NULL AND LicenseStatus !=1

Upvotes: 0

Santiago Squarzon
Santiago Squarzon

Reputation: 61083

I believe if you're looking for all objects where SoftwareLicensingProduct is NOT 1 then the syntax should be:

Get-WMIObject -Query 'SELECT LicenseStatus FROM SoftwareLicensingProduct WHERE LicenseStatus != 1'

Upvotes: 0

Related Questions