Jump to content

Code to check if system restore is active or disabled


Recommended Posts


im trying to find some code that can access WMI or the registry to see if system restore is active or not? Im trying to write a program to self check.

A lot depends on the code you are writing (script or program) and what you are doing with that code. If you are doing other things with system restore, the easiest is to check for the error ERROR_SERVICE_DISABLED on your first call to one of the SRCLIENT.DLL routines.

Otherwise, you can check for the status of the System Restore Service (srservice), and return an error if the service is not started, since this is how system restore works. For WMI, you can interrogate Win32_Service (http://msdn.microsoft.com/en-us/library/aa394418%28v=vs.85%29.aspx). For regular Win32 API, you can use QueryServiceConfig of the windows service API (http://msdn.microsoft.com/en-us/library/ms685942%28v=VS.85%29.aspx).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...