Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

filtering property for Get-WmiObject

$
0
0

I wanted to check a list of PC's to see if they had a static IP address set or not so I put together this bit

Get-WmiObject -ErrorAction SilentlyContinue -ComputerName $List Win32_NetworkAdapterConfiguration | where -property DHCPEnabled -eq False | Select DNSHostName, DHCPEnabled, MACAddress

 

Problem is it kicks back a True value for every computer in the list regardless of settings, here is an example.

 

DNSHostName                DHCPEnabled                    MACAddress                                            
                             
PC Name 1                        True                  00:50:56:A5:68:ED                                     
PC Name 2                        True                  00:50:56:A5:40:AB                                     
PC Name 3                        True                  00:50:56:A5:6E:66

 

Win32_NetworkAdapterConfiguration has several DHCPEnabled properties so I'm not sure how to get this to work. Any help would be awesome!

 

Here is what it looks like if I take out the where -property for one machine.

 

PC Name 1                     True {192.220.10.128, fe80::152a:3b4e:2802:f... 00:50:56:A5:40:AB                       
                                                                                False                                                                                   
                                                                                False                                                                                   
                                                                                False                                                                                   
                                                                                False                                                                                   
                                                                                False                                                                                   
                                                                                False                                                                                   
                                                                                False                                                                                   
                                                                                False                                                                                   
                                                                                False                                                                                    

False


Viewing all articles
Browse latest Browse all 6937

Trending Articles