Quantcast
Viewing all articles
Browse latest Browse all 10386

BgInfo : I need help with vbscript for lastwindowupdate

Author: reidor68
Subject: I need help with vbscript for lastwindowupdate
Posted: 15 January 2014 at 3:03pm

This works for me and also converts to local date (testet: bginfo4.2, Server2012R2)
Image may be NSFW.
Clik here to view.
Quote

'Special BGInfo Script
'Last Windows Update Install
On Error Resume Next
Dim dateValue
Set dateValue = CreateObject("WbemScripting.SWbemDateTime")

Set oShell = CreateObject("WScript.Shell")
oShell.run "reg export ""HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\Results\Install"" %temp%\reg_dump.reg /y /reg:64", DontShowWindow, WaitUntilFinished
oShell.run "reg import %temp%\reg_dump.reg /reg:32", DontShowWindow, WaitUntilFinished

const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\Results\Install"
strValueName = "LastSuccessTime"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
dateValue.SetVarDate dwValue

Echo dateValue.GetVarDate

Viewing all articles
Browse latest Browse all 10386

Trending Articles