Files
Powershell-Training/4.Networking/1.check_port.ps1

10 lines
212 B
PowerShell

$ports = 22,80
$ports | forEach-Object {
$port = $PSItem;
if(Test-NetConnection udemy.com -Port $port){
Write-Host "Hey, $port is open !"}
else {
Write-Host "Hey, $port is closed ! "}
}