XPero
8th October 2005 21:41 UTC
Detect System Restore Service state
Hi all. Ive tried several ways, but I cant get it to work. I need a way to detect (On Init) if System Restore Service is ON or OFF. If it is OFF, a message box will be shown letting the user to quit installation. Is this possible? Any help will be appreciated. Thanks
Anders
9th October 2005 00:40 UTC
i guess the easy solution is to use RegMon and look for a registry value (by turning system restore on or off)
a better solution is probably to use WMI in a custom plugin or vbs/jscript script
http://www.microsoft.com/windowsxp/p...iptsamples.asp
http://support.microsoft.com/default...295299&sd=tech
dandaman32
9th October 2005 09:58 UTC
The best way to do this would be to call $SYSDIR\sc.exe and analyse the return.
nsExec::ExecToStack '"$SYSDIR\sc.exe" query srservice'
Calling nsExec runs the program without showing a commandline popup window.
; now get return
Pop $0
StrCpy $0 $0 7 114
;at this point $0 will be "RUNNING" if srservice is running.
You can then do what you want with the string.
Why this works:
nsExec is capable of executing commandline apps and storing the return value in the stack. Whenever "sc.exe query srservice" is called from a command prompt (try it!) the first 114 characters of its output are always the same unless your users have recklessly modified their systems.
Working script attached.
-dandaman32
XPero
9th October 2005 13:30 UTC
Thanks guys, will try it soon. Also I need a YES NO pop up, but I think this can be made simply editing the line "MessageBox MB_OK|MB_ICONEXCLAMATION". Thanks
Anders
9th October 2005 18:49 UTC
the sc.exe way is language specific is it not? why not use one of the service plugins
XPero
22nd October 2005 15:17 UTC
Tried dandaman32 method only in English system and it works. I will try in Spanish one.
XPero
22nd October 2005 21:52 UTC
It works