Solved

Powershell WMI Query for DHCP

Posted on 2010-08-12
2
2,642 Views
Last Modified: 2012-05-10
I'm trying to build up a script that will query WMI on computers to determine if they are using DHCP or if they have a Static IP assigned to them. I'm not real sure if this is even possible. I'm not that great at WMI, so I could really use a good resource for figuring that part out. More specifically, I'm trying to find the spot in WMI where DHCP information is, and how to query that in powershell.
0
Comment
Question by:Adam Brown
2 Comments
 
LVL 6

Accepted Solution

by:
PWeerakoon earned 500 total points
ID: 33424557
Slightly modified the script found here...
http://pshscripts.blogspot.com/2009/01/get-ipaddressps1.html 

You could setup a variable
$computername = Get-Content "C:\TEMP\computerlist.txt"
and feed it to a foreach loop with the below script...
CLS

$IPconfigset = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName PC24211-VM02, PC24211

$count = 0  

foreach ($IPConfig in $IPConfigSet) 

{  

   if ($Ipconfig.IPaddress) 

   {  

      foreach ($addr in $Ipconfig.Ipaddress) 

		{  

		"IP Address    : {0}" -f  $addr; 

		"DHCP Enabled  : {0}" -f $Ipconfig.DHCPEnabled

		$count++   

		}  

   }

}

Open in new window

0
 
LVL 38

Author Closing Comment

by:Adam Brown
ID: 33425173
Got me what I wanted. Thanks.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
This tutorial will give a an overview on how to deploy remote agents in Backup Exec 2012 to new servers. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as connecting to a remote Back…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now