开发者

system restore status check

开发者 https://www.devze.com 2023-04-11 15:31 出处:网络
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 enabl

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");
}
0

精彩评论

暂无评论...
验证码 换一张
取 消