Advertisement
Guest User

Untitled

a guest
Feb 24th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. # Set System Restorepoint or Recover
  2.  
  3. function areyousure {$areyousure = read-host "Are you sure you want to exit? (y/n)"
  4. if ($areyousure -eq "y"){exit}
  5. if ($areyousure -eq "n"){mainmenu}
  6. else {write-host -foregroundcolor red "Invalid Selection"
  7. areyousure
  8. }
  9. }
  10. #Mainmenu function. Contains the screen output for the menu and waits for and handles user input.
  11. function mainmenu{
  12. cls
  13. echo "---------------------------------------------------------"
  14. echo ""
  15. echo ""
  16. echo " 1. Create System Restore Point"
  17. echo " 2. Restore System Restore Point"
  18. echo " 3. Show System Restore Points"
  19. echo " 4. Exit"
  20. echo ""
  21. echo ""
  22. echo "---------------------------------------------------------"
  23. $answer = read-host "Please Make a Selection"
  24. if ($answer -eq 1){$result = Read-Host 'Enter Name for RestorePoint'}
  25. Checkpoint-Computer -Description $result
  26. if ($answer -eq 2){$RPoint = Read-Host 'Enter Restore Point Number'}
  27. Restore-Computer -RestorePoint $RPoint
  28. if ($answer -eq 3){get-computerrestorepoint}
  29. if ($answer -eq 4){areyousure}
  30.  
  31. else {write-host -ForegroundColor red "Invalid Selection"
  32. sleep 15
  33. mainmenu
  34. }
  35. }
  36. mainmenu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement