Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help With WQL Query

Status
Not open for further replies.

tEkHEd

IS-IT--Management
Jan 29, 2003
261
GB
Hi there.. I am trying to find out what patches have been applied to a machine within the last month via the SMS 2K3 SoftwareUpdates FP.

I need to do this on the client so I am querying the Win32_PatchState WMI Class.

I am having a problem with the Date time format in WMI (Universal Time Code) as I can't do a Now() - 31 or DATEDIFF with this format.. can anyone point me in the right direction?
 
Give this a shot:

Code:
    Dim d As DateTime
    Dim d1 As DateTime
    d = System.DateTime.UtcNow() 'your WQL UTC Date value
    d1 = DateAdd(DateInterval.Day, -31, d) 'your target date
    MsgBox(d1.ToUniversalTime, MsgBoxStyle.OKOnly) 'the result

"I swear by my life and my love of it that I will never live for the sake of another man, nor ask another man to live for mine."
— John Galt
Atlas Shrugged

If you want to get the best response to a question, please check out FAQ222-2244 first

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top