Command
- wmic nic WHERE "PNPDeviceID LIKE '%PCI%' AND ProductName LIKE '%Wi%'" GET MacAddress | findstr /C:":"
Command Anatomy
- wmic - Windows CLI legacy tool for accessing WMI data
- nic - The alias of the WMI class we are querying
- WHERE
- PNPDeviceID LIKE '%PCI%' - Find results from the PNPDeviceID column that has the string 'PCI' anywhere in the string. Determines if device is a physical PCI device.
- AND
- ProductName LIKE '%Wi%' - Find results from the ProductName column that has the string 'Wi' anywhere in the string. Determines if device is a wireless adapter.
- GET
- MacAddress - The column we want results from
- |
- findstr - The find string command. WMIC returns results with headers and we are doing this to get only the MAC address without the header so we can directly return the result to the VSA agent procedure through #global:cmdresults#
- /C:":" - Specifying the pattern to the findstr command. ":" tells findstr to look for a colon.
Limitations
- Doesn't cater to USB devices
- Can break the agent procedure for machines with multiple physical devices (eg. Dual LAN)
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article