Basic example of managing your Filespace snapshots schedules in PowerShell. List, create, delete your schedules easily when linked to a Filespace as 'root' user.
Usage:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "managesnapshotschedules.ps1"
Script:
using namespace System.Management.Automation.Host function Menu { [CmdletBinding()] param( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$Title, [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string]$Question ) while ($true) { $list = [ChoiceDescription]::new('&List Schedules', 'List snapshot schedules') $create = [ChoiceDescription]::new('&Create Schedule', 'Create a new snapshot schedule') $delete = [ChoiceDescription]::new('&Delete Schedule', 'Delete a snapshot schedule') $quit = [ChoiceDescription]::new('&Quit', 'Exit') $options = [ChoiceDescription[]]($list, $create, $delete, $quit) $result = $host.ui.PromptForChoice($Title, $Question, $options, 0) switch ($result) { 0 {List} 1 {Create} 2 {Delete} 3 {exit} } } } function List { Lucid.exe snapshot-schedule } function Create { $name = Read-Host -Prompt 'Provide snapshot schedule name' $question = 'Define interval unit at which to create snapshots (e.g. d for daily)' $choices = '&Minute', '&Hour', '&Day', '&Week', 'm&Onth', '&Year' $title = '' $unit = $Host.UI.PromptForChoice($title, $question, $choices, 2) switch ($unit) { 0 {$unit = 'm'} 1 {$unit = 'h'} 2 {$unit = 'd'} 3 {$unit = 'w'} 4 {$unit = 'mo'} 5 {$unit = 'y'} } $interval = Read-Host -Prompt 'Interval numerical value (e.g. 1 for daily snapshots)' $retention = Read-Host -Prompt 'Number of snapshots to keep (e.g. keep last 7 snapshots)' $question = 'Do you want to specify start date/time?' $choices = '&Yes', '&No' $title = '' $decision = $Host.UI.PromptForChoice($title, $question, $choices, 1) if ($decision -eq 0) { while(1){ Try{ $datetime = [datetime] (read-host 'Enter any valid YYYY-MM-DD HH:MM date/time') break } Catch{ Write-Host 'Not a valid YYYY-MM-DD HH:MM format' -fore red } } $datetime = $datetime.ToString('yyyy-MM-dd'+'T'+'HH:mm') } else { $datetime = get-date $datetime = $datetime.ToString('yyyy-MM-dd'+'T'+'HH:mm') } lucid snapshot-schedule --create $name --interval $interval$unit --retention $retention --start $datetime } function Delete { Write-Host 'Ignore 1st password prompt if you know your snapshot schedule name' -fore green Lucid.exe snapshot-schedule $name = Read-Host -Prompt 'Delete snapshot by name' Lucid.exe snapshot-schedule --delete $name } Menu -Title 'Manage your Filespace snapshot schedules' -Question 'What would you like to do?'