Link to home
Start Free TrialLog in
Avatar of farid jan
farid jan

asked on

wmi query if machine connected to wifi/ethernet

wmi query if machine are connected  to ethernet cable

second  check if machine connected to wifi

thanks
Avatar of Leon Taljaard
Leon Taljaard
Flag of South Africa image

Hi,

Try and see if this will work for you, this is a PowerShell script.

$PCs = "localhost" #enter your PCs (or user get-content on a text file for this)
$IPRange = "10.21.240.*" #enter you ip address range

foreach ($PC in $PCs) {

$LAN = Get-WmiObject win32_networkadapterconfiguration -ComputerName localhost| select-object -ExpandProperty IPaddress

if ($LAN -like $IPRange) {

get-wmiobject win32_networkadapter -ComputerName $PC -filter "netconnectionstatus = 2" | select netconnectionid,name, netconnectionstatus| ft

}

}

Open in new window


Connection Status 2 will mean connected
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.