Created
February 13, 2019 18:07
-
-
Save Sporax/745c107a70b857e86489ce7355292426 to your computer and use it in GitHub Desktop.
Simple powershell script to ping or do math
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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