# encoding: ascii
# api: powershell
# title: CI Detection Wifi > LAN
# description: ConfigMgr CI Detection script for detecting if WMI Wifi Connection Metric is greater than LAN
# version: 802.3
# author: brockie
# license: CC0
# x-poshcode-id: 5797
# x-archived: 2016-11-14T08:35:21
# x-published: 2016-03-26T18:31:00
#
#
$LAN = Get-WmiObject Win32_NetworkAdapter -Filter "AdapterType='Ethernet 802.3'" |
Where-Object { ($_.NetConnectionID -notlike '*Wireless*' -or $_.NetConnectionID -notlike '*WiFi*' -or $_.NetConnectionID -notlike '*Wi-Fi*' ) -and $_.ServiceName -notlike '*NETw*' } |
ForEach-Object { $_.GetRelated('Win32_NetworkAdapterConfiguration') } | Where-Object {$_.IPEnabled -eq '$True'}
$WLAN = Get-WmiObject Win32_NetworkAdapter -Filter "AdapterType='Ethernet 802.3'" |
Where-Object { ($_.NetConnectionID -like '*Wireless*' -or $_.NetConnectionID -like '*WiFi*' -or $_.NetConnectionID -like '*Wi-Fi*' -or $_.ServiceName -like '*NETw*') } |
ForEach-Object { $_.GetRelated('Win32_NetworkAdapterConfiguration') } | Where-Object {$_.IPEnabled -eq '$True'}
IF ($LAN.IPConnectionMetric -eq $Null -or $WLAN.IPConnectionMetric -eq $Null) {"COMPLIANT"}
elseif ($LAN.IPConnectionMetric -lt $WLAN.IPConnectionMetric) {"COMPLIANT"}
else {$null}