popunder new

https://www.blogger.com/blog/posts/1739890295310631346

Tuesday, January 11, 2011

Enable or disable system restore on a remote computer

This script prompts for a remote pc name and then gives you the option to either enable or disable the system restore option.

Instructions:

1: Run the script

2: Enter the name or the ip address of the remote computer.

image

3: Select 1 to enable it or 2 to disable it.

image

I have tested the script on Windows 7 x86/x64. This must be run from an elevated command prompt. Domain Administrator permissions are required.

Download Button5

  'Enable or disable system restore on a remote system   
strComputer = InputBox("Enter the COMPUTER NAME or the IP address of the system you would like to enable or disable System Restore on. (use localhost for current system)","Remotely Enable or Disable System Restore","localhost")
If strComputer = "" Then
WScript.Quit
End If
strChoice = Inputbox ("System Restore:" & vbCrLf & vbCrLf & "1: Enable"& vbCrLf &"2: Disable" & vbCrLf& vbCrLf & vbCrLf & "Please enter 1 or 2 (leave blank to quit):","Enter 1 to Enable or 2 to Disable","")
If strChoice = "" Then
WScript.Quit
End If
if strChoice = 1 then
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default")
Set objItem = objWMIService.Get("SystemRestore")
errResults = objItem.Enable("")
'Inform User that the task is done.
Mybox = MsgBox("System Restore is now enabled on "& strComputer &"" & vbCRLF ,vbOkOnly,"System Restore Enabled")
End If
if strChoice = 2 then
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default")
Set objItem = objWMIService.Get("SystemRestore")
errResults = objItem.Disable("")
'Inform User that the task is done.
Mybox = MsgBox("System Restore is now disabled on "& strComputer &"" & vbCRLF ,vbOkOnly,"System Restore Disabled")
End If

No comments:

Post a Comment