Public/Start-AGMLibRansomwareRecovery.ps1
function Start-AGMLibRansomwareRecovery { <# .SYNOPSIS Guided menu to help user with finding right functions to handle ransomware attack .EXAMPLE Start-AGMLibRansomwareRecovery Runs a guided menu .DESCRIPTION A function to help users find the right commands to run #> # Clear-Host Write-Host "This function is designed to help you learn which functions to run during a ransomware attack." Write-host "Note that if you have not connected to AGM yet with Connect-AGM, then do this first before proceeding" Write-Host "What do you need to do?" Write-Host "" write-host "1`: Login to AGM Do you need to login to AGM with Connect-AGM?" Write-Host "2`: Check the scheduler Do you want to check if the scheduler is enabled?" Write-Host "3`: Stop new backups Do you want to stop the scheduler or expiration right now? This is to stop new backups being created." Write-Host "4`: Create an image list Do you want to create a list of images that you could use to identify which backups to use?" Write-Host "5`: Mount your image list Do you have a list of backups (from step 4) and you want to mount all of them at once?" Write-Host "6`: Unmount your images Do you want to unmount the images we mounted in step 5" write-host "7`: Set image labels Do you want to apply a label to an image or images to better tag that image?" write-host "8`: Exit" Write-Host "" # ask the user to choose While ($true) { Write-host "" $listmax = 8 [int]$userselection = Read-Host "Please select from this list [1-$listmax]" if ($userselection -lt 1 -or $userselection -gt $listmax) { Write-Host -Object "Invalid selection. Please enter a number in range [1-$listmax)]" } else { break } } if ($userselection -eq 1) { Connect-AGM Start-AGMLibRansomwareRecovery } if ($userselection -eq 2) { Clear-Host Write-Host "2`: Check the scheduler" Write-Host "" Write-Host "The function you need to run is: Get-AGMLibSLA" Write-Host "" Write-Host "1`: Exit, I will run it later (default)" Write-Host "2`: Run it now" [int]$userselection1 = Read-Host "Please select from this list [1-2]" if ($userselection1 -eq 2) { Clear-Host Get-AGMLibSLA Read-Host -Prompt "Press enter to continue" Start-AGMLibRansomwareRecovery } else { return } } if ($userselection -eq 3) { Clear-Host Write-Host "3`: Stop new backups" Write-Host "" Write-Host "The function you need to run is: Set-AGMLibSLA" Write-Host "" Write-Host "1`: Exit, I will run it later (default)" Write-Host "2`: Run it now" [int]$userselection2 = Read-Host "Please select from this list [1-2]" if ($userselection2 -eq 2) { Clear-Host Set-AGMLibSLA Read-Host -Prompt "Press enter to continue" Start-AGMLibRansomwareRecovery } else { return } } if ($userselection -eq 4) { Clear-Host Write-Host "4`: Create an image list" Write-Host "" Write-Host "The function you need to run is: Get-AGMLibImageRange" Write-Host "" Write-Host "1`: Exit, I will run it later (default)" Write-Host "2`: Run it now" [int]$userselection2 = Read-Host "Please select from this list [1-2]" if ($userselection2 -eq 2) { Get-AGMLibImageRange Read-Host -Prompt "Press enter to continue" Start-AGMLibRansomwareRecovery } else { return } } if ($userselection -eq 5) { Clear-Host Write-Host "5`: Mount your image list" Write-Host "" Write-Host "The function you need to run is: New-AGMLibMultiMount" Write-Host "" Write-Host "1`: Exit, I will run it later (default)" Write-Host "2`: Run it now" [int]$userselection2 = Read-Host "Please select from this list [1-2]" if ($userselection2 -eq 2) { New-AGMLibMultiMount } else { return } } if ($userselection -eq 6) { Clear-Host Write-Host "6`: Unmount your images" Write-Host "" Write-Host "The function you need to run is: Remove-AGMLibMount" Write-Host "" Write-Host "1`: Exit, I will run this later (default)" Write-Host "2`: Guide me now" [int]$userselection2 = Read-Host "Please select from this list [1-2]" if ($userselection2 -ne 2) { return } Remove-AGMLibMount } if ($userselection -eq 7) { Clear-Host write-host "7`: Set image labels" Write-Host "" Write-Host "The function you need to run is: Set-AGMLibImage" Write-Host "This function is used to label a large number of images in a single command. This is done by supplying one of the following: -- A list of images to label, normally created with New-AGMLibImageRange. We then use -imagelist <imagelist> -- A CSV file contained a list of images with new labels. The file needs to have at least id,backupname,label as headings. You could use New-AGMLibImageRange to create this file. Then use: -filename <filename.csv> -- An imagename. You could learn this in the AGM Web GUI. Then use: -imagename <imagename> -label <newlabel>" } if ($userselection -eq 8) { Return } } |