mikaelsnavy
2/5/2018 - 7:04 AM

Powershell check network

function Get-ActiveConnection
{
   Get-WmiObject -Class Win32_NetworkAdapterConfiguration  |
   Where-Object { $_.IPAddress } |
   Select-Object -ExpandProperty Description
}
 
function Test-ActiveConnection
{
 param([Parameter(Mandatory)]$Keyword)
 
 
 @(Get-WmiObject -Class Win32_NetworkAdapterConfiguration |
   Where-Object { $_.IPAddress } |
   Where-Object { $_.Description -like "*
$Keyword*" }).Count -gt 0
 
}