-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathEnable-RestorePoint.ps1
More file actions
34 lines (31 loc) · 1.22 KB
/
Enable-RestorePoint.ps1
File metadata and controls
34 lines (31 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function Enable-RestorePoint {
[CmdletBinding()]
param (
[Parameter(Mandatory=$false,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true)]
[ValidateNotNullOrEmpty()]
[String]$LogPath = "C:\Temp"
)
begin {
$logger.Notice("Starting $($MyInvocation.MyCommand) script")
Write-Output "Enabling Restore Points on (C:)"
}
process {
$logger.informational("Enabling Restore Points on (C:)")
Enable-ComputerRestore -Drive "C:\"
if ($env:UserName -like "*Some NonDomain User*") {
Write-Output "Creating Restore Point Called 'Beginning of Time'"
$logger.informational("Creating Restore Point Called 'Beginning of Time'")
Checkpoint-Computer -Description "Beginning of Time"
}
ELSE {
Write-Output "Creating Restore Point Called 'Beginning of $env:UserName'"
$logger.informational("Creating Restore Point Called 'Beginning of $env:UserName'")
Checkpoint-Computer -Description "Beginning of $env:UserName"
}
}
end {
$logger.Notice("Finished $($MyInvocation.MyCommand) script")
}
}