GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — PowerCLI-Example-Scripts/Scripts/get-ping.ps1 at master · madantnk/PowerCLI-Example-Scripts Expand file tree/ Copy pathget-ping.ps1More file actions 53 lines (39 loc) · 1.37 KB / Copy pathget-ping.ps1File metadata and controls53 lines (39 loc) · 1.37 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 Function Get-PingStatus { param( [Parameter(ValueFromPipeline=$true)] [string]$device, [validateSet("Online","Offline","ObjectTable")] [String]$getObject ) begin{ $hash = @() } process{ $device| foreach { if (Test-Connection $_ -Count 1 -Quiet) { if(-not($GetObject)){write-host -ForegroundColor green "Online: $_ "} $Hash = $Hash += @{Online="$_"} }else{ if(-not($GetObject)){write-host -ForegroundColor Red "Offline: $_ "} $Hash = $Hash += @{Offline="$_"} } } } end { if($GetObject) { $Global:Objects = $Hash | foreach { [PSCustomObject]@{ DeviceName = $_.Values| foreach { "$_" } Online = $_.Keys| where {$_ -eq "Online"} offline = $_.Keys| where {$_ -eq "Offline"} } } Switch -Exact ($GetObject) { 'Online' { $Global:Objects| where 'online'| select -ExpandProperty DeviceName } 'Offline' { $Global:Objects| where 'offline'| select -ExpandProperty DeviceName } 'ObjectTable' { return $Global:Objects } } } } } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |