System Restore Points pt 2

We have seen how to discover the available restore points. What about creating one.
001
002 003 004 005 006 007 008 009 010 011 012 013 |
function new-systemrestorepoint {
[CmdletBinding()] param ( [string]$computername=“.”, [string]$description=“Testing123” ) $test = Test-Connection -ComputerName $computername -Count 1 if (-not ($test)){Throw “Computer $computername not reachable” }
$sr = [wmiclass]“\\$computername\root\default:SystemRestore” |
We need to use [wmiclass] to create a new instance of the SystemRestore class. We can then use the CreateRestorePoint method with the description we’ve input as a parameter. The other paarmeters define it as an application install and begin system change respectively. This are generic enough to be left as is. They can be made parameters if required
 Comment on this Post