Skip to content

Instantly share code, notes, and snippets.

@Sporax
Created February 13, 2019 18:07
Show Gist options
  • Save Sporax/745c107a70b857e86489ce7355292426 to your computer and use it in GitHub Desktop.
Save Sporax/745c107a70b857e86489ce7355292426 to your computer and use it in GitHub Desktop.
Simple powershell script to ping or do math
Write-Host "Choose between these options:"
Write-Host
Write-Host "1. See a list of processes on the system"
Write-Host "2. See a list of services on the system"
Write-Host "3. Send a ping"
Write-Host "4. Double a number"
$userinput = Read-Host
if ( $userinput -eq "1") {
Get-Process
} elseif ( $userinput -eq "2" ) {
Get-Service
} elseif ( $userinput -eq "3" ) {
$target = Read-Host -prompt "Which user should I ping? "
ping $target
} elseif ( $userinput -eq "4" ) {
$num = Read-Host -prompt "Give me a number"
$updatednum = $num -as [int]
$updatednum = $updatednum * 2
Write-Host "Your original number was $num, but now it's $updatednum."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment