I am creating a script to monitor if a pc has more than one network connection, ie wired and wireless. The script below does not seem to work with the count option for the array. It just returns 0.
param( [string]$ComputerName = "", [array]$myNetCon = @() ) $myNetCon += Get-Netadapter -cimsession $ComputerName -physical | where status -eq 'up' if($myNetCon.Count -gt 1) { Write-Host("0:BAD") } else { Write-Host ("1:OK") }
Add comment