How to create a system restore point programmatically?

后端 未结 3 1198
迷失自我
迷失自我 2020-12-17 01:02

I\'m looking for a way to create a system restore point with the current date and time by pressing a button. I\'ve tried searching the web for a simple way to do this but I

3条回答
  •  悲&欢浪女
    2020-12-17 02:02

    var restPoint = GetObject(@"winmgmts:\\.\root\default:Systemrestore");
    if(restPoint!=null)
    {
        if(restPoint.CreateRestorePoint("", 0, 100) == 0)
        {
            //do something
        }
        else
        {
             //do something
        }
    }
    

提交回复
热议问题