Is there any way in C# console application to check whether the system restore is enabled or not. I am able to create a开发者_如何学运维nd end restore point but looking for way to check if it is enabled or disabled?
You might want to check this reg key, hope this helps!
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore
For XP - DisableSR: 0 = enabled, 1 = disabled
For Windows 7 - RPSessionInterval: 0 = disabled, 1 = enabled
I needed to do the same thing today and ran across your post. It is simplistic but this is what worked for me.
RegistryKey rk = Registry.LocalMachine;
RegistryKey rk1 = rk.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore");
string sysRestore = rk1.GetValue("RPSessionInterval").ToString();
if (sysRestore.Contains("1"))
{
MessageBox.Show("System Restore is Enabled");
}
if (sysRestore.Contains("0"))
{
MessageBox.Show("System Restore is Disabled");
}
精彩评论