Page 1 of 1 1
Topic Options
#176003 - 2007-05-05 01:17 AM Is there a way to determine if a computer needs a reboot from WinUpdate?
pearly Offline
Getting the hang of it
*****

Registered: 2004-02-04
Posts: 92
Hi, I was wondering if it's possible to determine whether or not a computer requires a reboot (Windows Update installation).

Our IT folks feeds down Windows Updates (once approved) to our computers in an application environment. I wanted to write a quick program that checks weekly every time a Windows Update has been issued by IT. Basically I need to know when to reboot.

Is this possible?

Top
#176004 - 2007-05-05 01:28 AM Re: Is there a way to determine if a computer needs a reboot from WinUpdate? [Re: pearly]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
WSUS reports when a client has a reboot pending and it nags the user. Despite that, we force a reboot on most clients every weekend whether they need to or not.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#176005 - 2007-05-05 01:33 AM Re: Is there a way to determine if a computer needs a reboot from WinUpdate? [Re: Les]
pearly Offline
Getting the hang of it
*****

Registered: 2004-02-04
Posts: 92
Is it possible to programmatically get at WSUS?

I was thinking we can always implement a monthly schedule of rebooting the systems.

Top
#176006 - 2007-05-05 01:42 AM Re: Is there a way to determine if a computer needs a reboot from WinUpdate? [Re: pearly]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
there is a reboot pending property...
dunno where it is stored though
_________________________
!

download KiXnet

Top
#176007 - 2007-05-05 01:59 AM Re: Is there a way to determine if a computer needs a reboot from WinUpdate? [Re: Lonkero]
pearly Offline
Getting the hang of it
*****

Registered: 2004-02-04
Posts: 92
registry? hmmm we'll need to some research
Top
#176010 - 2007-05-05 10:39 AM Re: Is there a way to determine if a computer needs a reboot from WinUpdate? [Re: pearly]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired

need to do enumvalue there.
if there is a val, reboot is pending.
_________________________
!

download KiXnet

Top
#176013 - 2007-05-05 06:49 PM Re: Is there a way to determine if a computer needs a reboot from WinUpdate? [Re: Lonkero]
AMD Offline
Fresh Scripter

Registered: 2007-03-12
Posts: 6
There is also this one to help detect

http://support.microsoft.com/kb/312444

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager
PendingFileRenameOperations

Top
#176014 - 2007-05-05 07:02 PM Re: Is there a way to determine if a computer needs a reboot from WinUpdate? [Re: AMD]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yeah.
the function is a bit different.
worms and other programs can keep stuff in there.

on the other hand, almost all installs write stuff there if they require reboot.
only windowsupdate writes to the key I gave.
_________________________
!

download KiXnet

Top
#176015 - 2007-05-06 07:34 AM Re: Is there a way to determine if a computer needs a reboot from WinUpdate? [Re: Lonkero]
AMD Offline
Fresh Scripter

Registered: 2007-03-12
Posts: 6
Yes true, not directed specifically at auto update.

Not only virus/worms, but before WUS/SUS and the Update Agent, ALL Microsoft updates requiring a reboot used the Pending key. Curious if MS has quit using that key altogether or not from a go forward point of view.


More information

http://blogs.msdn.com/hansr/default.aspx

Top
#176017 - 2007-05-06 10:51 AM Re: Is there a way to determine if a computer needs a reboot from WinUpdate? [Re: AMD]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
imo, all pending namings are there.
thus, all reboot requirements will show up in there as well.

it's just the way windows works.
_________________________
!

download KiXnet

Top
#176021 - 2007-05-06 02:56 PM Re: Is there a way to determine if a computer needs a reboot from WinUpdate? [Re: pearly]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4403
Loc: New Jersey
I have a library of Kix functions (WSUSLib) that supports the WSUS API. You can download the latest from my web site. With it, you can fully control the WSUS interface. I have my network set up to communicate with WSUS, but never download/install. The download and install process is tighly controlled by the Kix script. It supports the WSUS_Reboot_Pending call.

The library might be published here on KORG, but the full zip file with documents and sample scripts (and latest updates) is always on my web site.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#176031 - 2007-05-07 11:35 AM Re: Is there a way to determine if a computer needs a reboot from WinUpdate? [Re: Glenn Barnas]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
This works. Used the UDF you created Glenn.
Might be an idea to post the UDF’s as individual UDF’s in the UDF forum?

 Code:
Break on

$status = wuRestartStatus()
If $status = 0
	?"No restart required."
Else
	?"Restart required"
EndIf
Sleep 3

;FUNCTION       wuRestartStatus()
;
;ACTION         Determines the Restart Pending status
;
;AUTHOR         Glenn Barnas
;
;SYNTAX         wuRestartStatus()
;
;PARAMETERS     None
;
;REMARKS        A pending restart can prevent additional updates from being
;		 applied. This function should be called, and the system 
;		 restarted if needed, prior to attempting additional updates.
;
;RETURNS        Boolean indicating whether a restart is pending
;
;DEPENDENCIES   none
;
;TESTED WITH    W2K, WXP, W2K3
 
Function wuRestartStatus()

  Dim $ComputerStatus
  $ComputerStatus = CreateObject("Microsoft.Update.SystemInfo")
  $wuRestartStatus = $ComputerStatus.RebootRequired
  Exit @ERROR

EndFunction


Edited by Mart (2007-05-07 11:36 AM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#176043 - 2007-05-07 03:56 PM Re: Is there a way to determine if a computer needs a reboot from WinUpdate? [Re: Mart]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4403
Loc: New Jersey
I had not posted individual UDFs because they, like my XLlib and TClib collections, are all highly related to one another. It would be rare to use them individually. This ONE might be the excption, however. ;\)

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#176063 - 2007-05-07 07:00 PM Re: Is there a way to determine if a computer needs a reboot from WinUpdate? [Re: Glenn Barnas]
pearly Offline
Getting the hang of it
*****

Registered: 2004-02-04
Posts: 92
Cool thanks guys! I tried out the UDF on WK3 and it worked great.

I think this function would be a great addition to the UDF Forum. I can see how this can be used individually (like my program).

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2375 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.081 seconds in which 0.053 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org