Reboot for machine
This issue has been solved. See solution.
Is it possible to get to know from script or any other method that the machine equires a reboot due to installation of some application.
When an application is installed and we say that restart later, then is it possible to know whether the machine requires reboot at any point of time.
I don't think there is a easy
I don't think there is a easy way to find out if there isn't some notifier involved to notify of such event.
The only instance a reboot is really required would be to either replace a locked (in-use) file or install/remove a system service as they start/stop during reboot.
For replacing files in-use PendingFileRenameOperations is often used so check the registry entry.
And for system services you would need to check what services that is in place and if they are started or not. Type DWORD entries with a value of "0x2" should indicate a system/kernel service. For more information about service registry entries have a look at CurrentControlSet\Services Subkey Entries.
Exit Code?
Can you check the exit code of the application? Assuming you are using an MSI, if it requires a reboot, it shoulkd exit with a 3010 exit code.
Example:
Dim strSuccess,strReboot
strSuccess = "The installation of 2008 Hotfix was successful."
strReboot = "The install of 2008 Hotfix was successful. The computer will now reboot."
HotFixFailure = "The installation of the 2008 hotfix was unsuccessful." &_
"please contact the Technical Service Desk for assistance."
HotFixTitle = "2008 Hotfix"
Select Case returnVal
Case 0
wrtLog strSuccess
oShell.Popup "appname successfully installed",30,"appname",4160
End If
Case 3010
wrtLog strSuccess & strReboot
oShell.Run "shutdown -r -f -t 10",0
WScript.quit(3010)
Case Else
oShell.Popup "There was a serious error during the installation, please contact your System Administrator",30,"Error",4112
oShell.Popup HotFixFailure,30,HotFixTitle,4112
WScript.Quit(1)
End Select
Good Luck
Kevin Elwell
thanks but
Hi Kevin, Thanks for your input, but this was not quite what I was looking for. However, AngelD did get to know what I am looking for. Thanks AngelD for that. But I am still looking for some other better solution as I still think there would be. I hope to get one.. If someone else knows abot the solution, I would be happy to try that... Else I will implement the solution given by AngelD.
Piyush Nasa
Altiris Certified Professional (ACP)
I think the only way would be
I think the only way would be to build a DLL with the relevant API call in it to watch for the Windows WM_QUERYENDSESSION message. I found some VC++ code here www.planet-source-code.com/vb/scripts/ShowCode.asp which you could probably adapat to suit.
Don't know why 'x' happened? Want to know why 'y' happened? Use ProcMon and it will tell you.
Think about using http://www.google.com before posting.
Would you like to reply?
Login or Register to post your comment.