{"id":4331,"date":"2013-01-13T00:01:00","date_gmt":"2013-01-13T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2013\/01\/13\/weekend-scripter-parsing-the-dhcp-database-no-way\/"},"modified":"2013-01-13T00:01:00","modified_gmt":"2013-01-13T00:01:00","slug":"weekend-scripter-parsing-the-dhcp-database-no-way","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/weekend-scripter-parsing-the-dhcp-database-no-way\/","title":{"rendered":"Weekend Scripter: Parsing the DHCP Database? No Way!"},"content":{"rendered":"<p><strong>Summary:<\/strong> Microsoft Scripting Guy, Ed Wilson, talks about a Windows PowerShell function from the DHCPServer module that permits parsing the DHCP database.<\/p>\n<p>Microsoft Scripting Guy, Ed Wilson, is here. Give us enough time, and eventually we get it right. Yes, it is now possible to use Windows PowerShell to parse the DHCP server database of IPv4 leases (you can also parse the IPv6 lease database as well). Why is this good news? Well, first of all, DHCP uses an .mdb<em> <\/em>file format and, as most people know, that is a &ldquo;standard jet database&rdquo; format. Microsoft Access used to use an .mdb<em> <\/em>file format, and so one should be able to query the DHCP database by using standard database types of tools. Well, actually until Windows Server 2012 that was not supported.<\/p>\n<p style=\"padding-left: 30px\"><strong>Note<\/strong> &nbsp;&nbsp;This is the fourth article in a series of Hey, Scripting Guy! Blog posts where I talk about using Windows PowerShell to work with Microsoft DHCP servers. I began the series with <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2013\/01\/10\/use-powershell-to-query-ad-ds-for-dhcp-servers.aspx\" target=\"_blank\">Use PowerShell to Query AD DS for DHCP Servers<\/a><em>, <\/em>in which I talked about using the <strong>Get-ADObject<\/strong> cmdlet to query for DHCP servers. I followed this with <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2013\/01\/11\/use-a-powershell-functions-to-authorize-dhcp-servers.aspx\" target=\"_blank\">Use PowerShell Functions to Authorize DHCP Servers<\/a><em>. <\/em>In this blog post, I talked about using several Windows PowerShell functions from the DHCPServer module. I query for DHCP servers, authorize DHCP servers, and deauthorize DHCP servers in this article. Yesterday, I wrote <a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/2013\/01\/12\/weekend-scripter-dhcp-address-conflict-detection.aspx\" target=\"_blank\">Weekend Scripter: DHCP Address Conflict Detection<\/a><em> <\/em>in which I talked about making changes to the DHCP server configuration. Today&rsquo;s post builds on these articles, and I recommend you read them in order as I am not level-setting in each article.<\/p>\n<h2>Query the DHCP IPv4 lease database<\/h2>\n<p>Well, why would one want to query DHCP? For one thing, on a really small network that might not really be necessary. I might just as well use the DHCP tool. The DHCP tool is shown here.<\/p>\n<p>&nbsp;<a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/5127.HSG-1-13-13-01.png\"><img decoding=\"async\" title=\"Image of DHCP tool\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/5127.HSG-1-13-13-01.png\" alt=\"Image of DHCP tool\" \/><\/a><\/p>\n<p>Of course, there are a couple of problems with using the DHCP tool. First, it is slow to make the connection. Next, it requires a decent amount of mousing around, and last of all, it always prompts to save changes (even if I have made no changes and cannot tell what it really does with this prompt anyway).<\/p>\n<p>Now with Windows PowerShell, it is fast&mdash;I do not even need to load the DHCPServer module because with Windows PowerShell&nbsp;3.0, it auto-loads.<\/p>\n<p>There are a number of occasions when querying the DHCP server IPv4 lease database makes sense, as listed here.<\/p>\n<ol>\n<li>To check on IP address use.<\/li>\n<li>To check IP lease expiration.<\/li>\n<li>To map MAC addresses to IP addresses.<\/li>\n<\/ol>\n<p>There are other pieces of information available as well, such as NAP status, DHCP policy enforcement, DNS registration info, and even end-time of probation period.<\/p>\n<h2>First find the available scopes<\/h2>\n<p>The first thing I need to know is what DHCP IPv4 scopes reside on the DHCP server. To find this information, I use the <strong>Get-DhcpServerv4Scope<\/strong> function and specify the computer name. To query a specific DHCP server, use the server name or IP address. The <strong>ComputerName<\/strong><em> <\/em>parameter is not a default parameter, and therefore, when not present, the function attempts to query the local computer. Also the <strong>ComputerName<\/strong><em> <\/em>parameter is not positional, and therefore, when left off, an error arises. Luckily, the <strong>ComputerName<\/strong><em> <\/em>parameter has an alias of <strong>CN<\/strong><em>, <\/em>and therefore, I can avoid typing the long parameter name, as shown here.<\/p>\n<p style=\"padding-left: 30px\">PS C:\\&gt; Get-DhcpServerv4Scope -cn wds1<\/p>\n<p style=\"padding-left: 30px\">ScopeId&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SubnetMask&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; State&nbsp;&nbsp;&nbsp; StartRange&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EndRange<\/p>\n<p style=\"padding-left: 30px\">&#8212;&#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8211;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8211;<\/p>\n<p style=\"padding-left: 30px\">192.168.0.0&nbsp;&nbsp;&nbsp;&nbsp; 255.255.255.0&nbsp;&nbsp; lan&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Active&nbsp;&nbsp; 192.168.0.40&nbsp;&nbsp;&nbsp; 192.168.0.90<\/p>\n<p style=\"padding-left: 30px\">192.168.2.0&nbsp;&nbsp;&nbsp;&nbsp; 255.255.255.0&nbsp;&nbsp; WireLess&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Active&nbsp;&nbsp; 192.168.2.50&nbsp;&nbsp;&nbsp; 192.168.2.99<\/p>\n<p style=\"padding-left: 30px\">192.168.3.0&nbsp;&nbsp;&nbsp;&nbsp; 255.255.255.0&nbsp;&nbsp; Autodeploy&nbsp;&nbsp;&nbsp;&nbsp; Active&nbsp;&nbsp; 192.168.3.1&nbsp; &nbsp;&nbsp;&nbsp;192.168.3&#8230;<\/p>\n<h2>Query the DHCP server lease database<\/h2>\n<p>Now that I know what scopes reside on the DHCP server, I can query for lease assignments by scope. This is shown here.<\/p>\n<p style=\"padding-left: 30px\">PS C:\\&gt; Get-DhcpServerv4Lease -ComputerName wds1 -AllLeases -ScopeId 192.168.0<\/p>\n<p style=\"padding-left: 30px\">IPAddress&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ScopeId&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ClientId&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HostName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AddressSta<\/p>\n<p style=\"padding-left: 30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; te<\/p>\n<p style=\"padding-left: 30px\">&#8212;&#8212;&#8212;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8212;-<\/p>\n<p style=\"padding-left: 30px\">192.168.0.40&nbsp;&nbsp;&nbsp; 192.168.0.0&nbsp;&nbsp;&nbsp;&nbsp; c4-3d-c7-a2-87-eb&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Active<\/p>\n<p style=\"padding-left: 30px\">192.168.0.41&nbsp;&nbsp;&nbsp; 192.168.0.0&nbsp;&nbsp;&nbsp;&nbsp; 00-1d-7e-62-29-78&nbsp;&nbsp;&nbsp; Router1.iammred.net&nbsp; Active<\/p>\n<p style=\"padding-left: 30px\">192.168.0.42&nbsp;&nbsp;&nbsp; 192.168.0.0&nbsp;&nbsp;&nbsp;&nbsp; f0-de-f1-7d-97-7c&nbsp;&nbsp;&nbsp; edLT.iammred.net&nbsp;&nbsp;&nbsp;&nbsp; Active<\/p>\n<p style=\"padding-left: 30px\">192.168.0.43&nbsp;&nbsp;&nbsp; 192.168.0.0&nbsp;&nbsp;&nbsp;&nbsp; e0-69-95-36-4e-e5&nbsp;&nbsp;&nbsp; Hyperv3.iammred.net&nbsp; Active<\/p>\n<p style=\"padding-left: 30px\">192.168.0.44&nbsp;&nbsp;&nbsp; 192.168.0.0&nbsp;&nbsp;&nbsp;&nbsp; c0-3f-0e-3b-58-b6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Active<\/p>\n<p style=\"padding-left: 30px\">192.168.0.45&nbsp;&nbsp;&nbsp; 192.168.0.0&nbsp;&nbsp;&nbsp;&nbsp; 00-21-86-52-f0-d6&nbsp;&nbsp;&nbsp; EDWILSON_LT.north&#8230; Active<\/p>\n<p style=\"padding-left: 30px\">192.168.0.46&nbsp;&nbsp;&nbsp; 192.168.0.0&nbsp;&nbsp;&nbsp;&nbsp; 00-24-e8-3e-99-2a&nbsp;&nbsp;&nbsp; hyperv2.iammred.net&nbsp; Active<\/p>\n<p style=\"padding-left: 30px\">192.168.0.54&nbsp;&nbsp;&nbsp; 192.168.0.0&nbsp;&nbsp;&nbsp;&nbsp; 00-15-5d-00-2d-16&nbsp;&nbsp;&nbsp; Web1.iammred.net&nbsp;&nbsp;&nbsp;&nbsp; Active<\/p>\n<p>Now, if I am interested in a specific computer, I can use regular Windows PowerShell filtering techniques. I do not need to type the entire DNS host name&mdash;I can use the match operator to filter out part of the host name, as shown here.<\/p>\n<p style=\"padding-left: 30px\">PS C:\\&gt; Get-DhcpServerv4Lease -ComputerName wds1 -AllLeases -ScopeId 192.168.0 | ?<\/p>\n<p style=\"padding-left: 30px\">&nbsp;hostname -match edlt<\/p>\n<p style=\"padding-left: 30px\">IPAddress&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ScopeId&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ClientId&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HostName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AddressSta<\/p>\n<p style=\"padding-left: 30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; te<\/p>\n<p style=\"padding-left: 30px\">&#8212;&#8212;&#8212;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8212;-<\/p>\n<p style=\"padding-left: 30px\">192.168.0.42&nbsp;&nbsp;&nbsp; 192.168.0.0&nbsp;&nbsp;&nbsp;&nbsp; f0-de-f1-7d-97-7c&nbsp;&nbsp;&nbsp; edLT.iammred.net&nbsp;&nbsp;&nbsp;&nbsp; Active<\/p>\n<p>If I want to see full lease information for the edLT computer, I pipe the results of the previous command to the <strong>Format-Table<\/strong> cmdlet (<strong>fl<\/strong> is the alias for this cmdlet). The command and the associated information returned by the command appear in the image that follows.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/1854.HSG-1-13-13-02.png\"><img decoding=\"async\" title=\"Image of command output\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/1854.HSG-1-13-13-02.png\" alt=\"Image of command output\" \/><\/a><\/p>\n<p>If I want to look at the DHCP lease expiration dates, I select the <strong>LeaseExpiryTime<\/strong> property. The following command selects the IP address, the host name, and the lease expiration time, and then sorts the results by expiration time in ascending fashion.<\/p>\n<p style=\"padding-left: 30px\">15:16 C:\\&gt; Get-DhcpServerv4Lease -ComputerName wds1 -AllLeases -ScopeId 192.168.0 |<\/p>\n<p style=\"padding-left: 30px\">select ipaddress, hostname, leaseExpiryTime | sort leaseExpiryTime<\/p>\n<p style=\"padding-left: 30px\">IPAddress&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hostname&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;leaseExpiryTime<\/p>\n<p style=\"padding-left: 30px\">&#8212;&#8212;&#8212;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p style=\"padding-left: 30px\">192.168.0.43&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Hyperv3.iammred.net&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1\/17\/2013 1:59:53 PM<\/p>\n<p style=\"padding-left: 30px\">192.168.0.44&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1\/17\/2013 2:10:22 PM<\/p>\n<p style=\"padding-left: 30px\">192.168.0.40&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1\/17\/2013 4:47:30 PM<\/p>\n<p style=\"padding-left: 30px\">192.168.0.54&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Web1.iammred.net&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1\/18\/2013 3:25:44 AM<\/p>\n<p style=\"padding-left: 30px\">192.168.0.41&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Router1.iammred.net&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1\/18\/2013 11:17:34 AM<\/p>\n<p style=\"padding-left: 30px\">192.168.0.46&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hyperv2.iammred.net&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1\/18\/2013 9:47:54 PM<\/p>\n<p style=\"padding-left: 30px\">192.168.0.42&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; edLT.iammred.net&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1\/19\/2013 9:38:18 AM<\/p>\n<p style=\"padding-left: 30px\">192.168.0.45&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EDWILSON_LT.northamerica&#8230; 1\/19\/2013 9:40:15 AM<\/p>\n<p>One more cool thing today, and then I need to leave for the airport for my trip to Redmond. At times, I need to work with a class of machines that all came from the same maker at the same time. In all likelihood, these machines will have similar MAC addresses because the <a href=\"http:\/\/standards.ieee.org\/develop\/regauth\/oui\/oui.txt\" target=\"_blank\">first three hexadecimal numbers identify the maker<\/a>. For example, a MAC prefix of 00-15-5d belongs to the Microsoft Corporation and might be found in use by a virtual machine. The following illustrates this technique.<\/p>\n<p style=\"padding-left: 30px\">15:19 C:\\&gt; Get-DhcpServerv4Lease -ComputerName wds1 -AllLeases -ScopeId 192.168.0 |<\/p>\n<p style=\"padding-left: 30px\">? clientID -match &#8216;^00-15-5d&#8217;<\/p>\n<p style=\"padding-left: 30px\">IPAddress&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ScopeId&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ClientId&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HostName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AddressSta<\/p>\n<p style=\"padding-left: 30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; te<\/p>\n<p style=\"padding-left: 30px\">&#8212;&#8212;&#8212;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8212;-<\/p>\n<p style=\"padding-left: 30px\">192.168.0.54&nbsp;&nbsp;&nbsp; 192.168.0.0&nbsp;&nbsp;&nbsp;&nbsp; 00-15-5d-00-2d-16&nbsp;&nbsp;&nbsp; Web1.iammred.net&nbsp;&nbsp;&nbsp;&nbsp; Active<\/p>\n<p>I invite you to follow me on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\">Facebook<\/a>. If you have any questions, send email to me at <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, peace.<\/p>\n<p><strong>Ed Wilson, Microsoft Scripting Guy<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Microsoft Scripting Guy, Ed Wilson, talks about a Windows PowerShell function from the DHCPServer module that permits parsing the DHCP database. Microsoft Scripting Guy, Ed Wilson, is here. Give us enough time, and eventually we get it right. Yes, it is now possible to use Windows PowerShell to parse the DHCP server database of [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[218,37,3,61,45],"class_list":["post-4331","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-dhcp-server","tag-networking","tag-scripting-guy","tag-weekend-scripter","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Microsoft Scripting Guy, Ed Wilson, talks about a Windows PowerShell function from the DHCPServer module that permits parsing the DHCP database. Microsoft Scripting Guy, Ed Wilson, is here. Give us enough time, and eventually we get it right. Yes, it is now possible to use Windows PowerShell to parse the DHCP server database of [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/4331","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=4331"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/4331\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=4331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=4331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=4331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}