Способ 1:
RegistryKey rk = Registry.LocalMachine;
RegistryKey rk1 = rk.OpenSubKey(@"SOFTWAREMicrosoftWindows NTCurrentVersionSystemRestore");
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");
}
Способ 2:
string osDrive = Path.GetPathRoot(Environment.SystemDirectory);
ManagementScope scope = new ManagementScope("\\localhost\root\default");
ManagementPath path = new ManagementPath("SystemRestore");
ObjectGetOptions options = new ObjectGetOptions();
ManagementClass process = new ManagementClass(scope, path, options);
ManagementBaseObject inParams = process.GetMethodParameters("Enable");
inParams["WaitTillEnabled"] = true;
inParams["Drive"] = osDrive;
ManagementBaseObject outParams = process.InvokeMethod("Enable", inParams, null);
0.00 (0%) 0 votes










