Mr. Shady Posted September 9, 2008 Share Posted September 9, 2008 Hi everybody!Help me please! I need to create a system restore point by a batch file or by a vbs-script (I mean without System Restore's GUI). So, I have a VBS-script which does not work:Set IRP = getobject("winmgmts:\.\root\default:Systemrestore")MYRP = IRP.createrestorepoint ("Restore", 0, 100) There is an error:Script: I:\restore.vbsLine: 1Symbol: 1Error: 0x80041021Code: 80041021Source: (null)So, who can help me?PS I'm so sorry for my English - Russian is my native language... Link to comment Share on other sites More sharing options...
jaclaz Posted September 9, 2008 Share Posted September 9, 2008 Cannot say if this is the problem, but this:winmgmts:\.\root\default:Systemrestoreshould be:winmgmts:\\.\root\default:SystemrestoreSee this KB:http://support.microsoft.com/kb/295299/en-usjaclaz Link to comment Share on other sites More sharing options...
Yzöwl Posted September 9, 2008 Share Posted September 9, 2008 There are many examples of scripts for this sort of thing available netwide, here's one such exampleHope it helps you out! Link to comment Share on other sites More sharing options...
Mr. Shady Posted September 9, 2008 Author Share Posted September 9, 2008 (edited) jaclaz, thank you very much! It work's!!! :thumbupYzöwl, thank you too, your link helps me too ;-) Edited September 9, 2008 by Mr. Shady Link to comment Share on other sites More sharing options...
gunsmokingman Posted September 9, 2008 Share Posted September 9, 2008 Here is a Vbs script that will set a restore pointSave As CreateSRPoint.vbsOption Explicit'-> VariblesDim Chk1, Chk2, Chk3, CSRP, RP, SRName, SRP'-> Get User Input SRName = InputBox("Type in the name for the SystemRestore.")'-> Checks Input Then Starts The Restore Process If SRName = "" Then 'Cancel Reply Chk1 = True ElseIf Len(SRName) = 0 Then 'Ok Was Pushed But Nothing In The Inputbox Chk1 = True ElseIf Len(SRName) > 3 Then 'Make Sure There At Least 3 Characters '-> Make The Restore Point Set SRP = GetObject("winmgmts:\\.\root\default:Systemrestore") CSRP = SRP.createrestorepoint(SRName, 0, 100) '-> Check To See If It Was Created Set SRP = GetObject("winmgmts:root/default").InstancesOf ("SystemRestore") For Each RP In SRP If InStr(RP.Description,SRName) Then Chk1 = False Chk2 = False Chk3 = True End If Next Else 'Less The 3 Characters Chk2 = True End If'-> Report Back If Chk1 = True Then Msgbox "There Was No User Input Cannot Create Restore Point", 4128, "Error No Input" WScript.Quit(0) End If If Chk2 = True Then Msgbox "There Needs To Be 3 Charters For It To Be Valid", 4128, "Not Valid" WScript.Quit(0) End If If Chk3 = True Then Msgbox "The New System Restore Point Has Been Created", 4128, "Confirm Restore Point" Else Msgbox vbtab & "Error Unknown" & vbCrLf & "System Restore Point Not Created", 4128, "Error Unknown" End If Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now