Remaining Days over Future Date

We are trying to report the remaining grace period for Office licenses in number of days instead of future date. We’re not having luck. Any takers?

Q:  (it * minute + now) whose(it > now) of integer values of selects "GracePeriodRemaining from SoftwareLicensingProduct WHERE PartialProductKey is not NULL" of wmis
A: Mon, 12 Nov 2018 06:27:24 -0400
A: Sun, 24 Mar 2019 05:41:24 -0400
T: 644.948 ms
I: plural time
F: Fingerprintable: true, Path: 0x00000001, Path Sum: 0x00371fa4, Bits: 0x80000000, Global Sum: 0x00372993, Seems Unchanged: true

Q:  (it / day) of (it * minute) whose(it > now) of integer values of selects "GracePeriodRemaining from SoftwareLicensingProduct WHERE PartialProductKey is not NULL" of wmis
E: The operator "less than" is not defined.

Since the Grace Period Remaining is in minutes, for returning days how about:

q: (it as integer / 1440) of (integer values of selects “GracePeriodRemaining from SoftwareLicensingProduct WHERE PartialProductKey is not NULL” of wmis)

I didn’t know how to add the text “Days” onto the end of the result.

That’s the ticket! Thank you so much.

This is probably more of a WMI coding thing, but given the below relevance:

Q:  string values of selects "PartialProductKey from SoftwareLicensingProduct WHERE PartialProductKey is not NULL" of wmis
A: T8X9C
A: 2YT43
T: 313.018 ms
I: plural string

In addition to excluding “NULL”, I also want to exclude “2YT43” (and perhaps others). Is that possible?

There is probably a way but I don’t know how right now, maybe someone else can show how it would be done.

One quick way to do it would be using relevance to exclude the values you don’t want:

q: string values of selects "PartialProductKey from SoftwareLicensingProduct WHERE PartialProductKey is not NULL" of wmis
A: 2YT43
A: WFG99
T: 95.418 ms
I: plural string

q: string values whose (it != "2YT43") of selects "PartialProductKey from SoftwareLicensingProduct WHERE PartialProductKey is not NULL" of wmis
A: WFG99
T: 58.190 ms
I: plural string

It always looks so simple when someone else does it! :yum: I must not have the programmers gene. Thank you so much!

1 Like