Advertisement
Guest User

Untitled

a guest
Jan 11th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function runFunction(){
  2.     [int] $option = Read-Host("Please select your option below: `n 1) List Processes `n 2) List Services `n 3) Ping a  Host `n 4) Doulbe a number `n 5) to exit `n")
  3.  
  4.     if ($option -eq 1){
  5.         Get-Process
  6.         Read-Host("Enter to continue")
  7.     }
  8.     elseif($option -eq 2){
  9.         Get-Service
  10.         Read-Host("Enter to continue")
  11.     }
  12.     elseif($option -eq 3){
  13.         $target = Read-Host("Enter the host (IP/FQDN) you'd like to ping ")
  14.         Test-Connection($target)
  15.         #Read-Host("Enter to continue")
  16.     }
  17.     elseif($option -eq 4){
  18.         [int] $number = Read-Host("Enter a number to be doubled ")
  19.         Write-Host("Your original number was " + $number + ", but now it's " + ($number * 2))
  20.         Read-Host("Enter to continue")
  21.     }
  22.     elseif($option -eq 5){
  23.         exit
  24.     }
  25.     else{
  26.         Write-Host("Invalid option, please select 1-4")
  27.     }
  28.     runFunction
  29.  
  30. }
  31.  
  32. runFunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement