Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Set System Restorepoint or Recover
- function areyousure {$areyousure = read-host "Are you sure you want to exit? (y/n)"
- if ($areyousure -eq "y"){exit}
- if ($areyousure -eq "n"){mainmenu}
- else {write-host -foregroundcolor red "Invalid Selection"
- areyousure
- }
- }
- #Mainmenu function. Contains the screen output for the menu and waits for and handles user input.
- function mainmenu{
- cls
- echo "---------------------------------------------------------"
- echo ""
- echo ""
- echo " 1. Create System Restore Point"
- echo " 2. Restore System Restore Point"
- echo " 3. Show System Restore Points"
- echo " 4. Exit"
- echo ""
- echo ""
- echo "---------------------------------------------------------"
- $answer = read-host "Please Make a Selection"
- if ($answer -eq 1){$result = Read-Host 'Enter Name for RestorePoint'}
- Checkpoint-Computer -Description $result
- if ($answer -eq 2){$RPoint = Read-Host 'Enter Restore Point Number'}
- Restore-Computer -RestorePoint $RPoint
- if ($answer -eq 3){get-computerrestorepoint}
- if ($answer -eq 4){areyousure}
- else {write-host -ForegroundColor red "Invalid Selection"
- sleep 15
- mainmenu
- }
- }
- mainmenu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement