{"id":381,"date":"2022-04-25T09:45:23","date_gmt":"2022-04-25T08:45:23","guid":{"rendered":"http:\/\/darko-keric.from.hr\/?p=381"},"modified":"2022-04-25T09:45:23","modified_gmt":"2022-04-25T08:45:23","slug":"dhcp-report-powershell-script","status":"publish","type":"post","link":"http:\/\/darko-keric.from.hr\/?p=381","title":{"rendered":"DHCP report powershell script"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p># Find all DHCP Server in Domain<br \/>\n$DhcpServers = Get-DhcpServerInDC<\/p>\n<p>foreach ($DHCPServer in $DhcpServers.DnsName){<br \/>\nif (Test-Connection -BufferSize 32 -Count 1 -ComputerName $dhcpserver -Quiet){<br \/>\n$ErrorActionPreference = \u201cSilentlyContinue\u201d<br \/>\n$Scopes = Get-DhcpServerv4Scope -ComputerName $DHCPServer<br \/>\n#For all scopes in the DHCP server, get the scope options and add them to $LIstofSCopesandTheirOptions<br \/>\nforeach ($Scope in $Scopes){<br \/>\n$LIstofSCopesandTheirOptions += Get-DHCPServerv4OptionValue -ComputerName $DHCPServer -ScopeID $Scope.ScopeId | Select-Object @{label=\u201dDHCPServer\u201d; Expression= {$DHCPServer}},@{label=\u201dScopeID\u201d; Expression= {$Scope.ScopeId}},@{label=\u201dScopeName\u201d; Expression= {$Scope.Name}},@{Name=\u2019Value\u2019;Expression={[string]::join(\u201c;\u201d, ($_.Value))}},*<br \/>\n}<br \/>\n$LIstofSCopesandTheirOptions += Get-DHCPServerv4OptionValue -ComputerName $DHCPServer | Select-Object @{label=\u201dDHCPServer\u201d; Expression= {$DHCPServer}},@{Name=\u2019Value\u2019;Expression={[string]::join(\u201c;\u201d, ($_.Value))}},*<br \/>\n$ErrorActionPreference = \u201cContinue\u201d<br \/>\n}<br \/>\n}<\/p>\n<p>#Now we have them all, output them<br \/>\n$LIstofSCopesandTheirOptions | Export-Csv -Path c:\\temp\\DhcpOptionsReport.csv -Force<br \/>\n#$ListofScopesandTheirOptions | Out-GridView<br \/>\n#<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; &nbsp; # Find all DHCP Server in Domain $DhcpServers = Get-DhcpServerInDC foreach ($DHCPServer in $DhcpServers.DnsName){ if (Test-Connection -BufferSize 32 -Count 1 -ComputerName $dhcpserver -Quiet){ $ErrorActionPreference = \u201cSilentlyContinue\u201d $Scopes = Get-DhcpServerv4Scope -ComputerName $DHCPServer #For all scopes in the DHCP server, &hellip; <a href=\"http:\/\/darko-keric.from.hr\/?p=381\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":348,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0},"categories":[1],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v17.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/darko-keric.from.hr\/?p=381\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"DHCP report powershell script - Sistemski in\u017eenjer\" \/>\n<meta property=\"og:description\" content=\"&nbsp; &nbsp; # Find all DHCP Server in Domain $DhcpServers = Get-DhcpServerInDC foreach ($DHCPServer in $DhcpServers.DnsName){ if (Test-Connection -BufferSize 32 -Count 1 -ComputerName $dhcpserver -Quiet){ $ErrorActionPreference = \u201cSilentlyContinue\u201d $Scopes = Get-DhcpServerv4Scope -ComputerName $DHCPServer #For all scopes in the DHCP server, &hellip; Continue reading &rarr;\" \/>\n<meta property=\"og:url\" content=\"http:\/\/darko-keric.from.hr\/?p=381\" \/>\n<meta property=\"og:site_name\" content=\"Sistemski in\u017eenjer\" \/>\n<meta property=\"article:published_time\" content=\"2022-04-25T08:45:23+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"darko-keric\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/darko-keric.from.hr\/#website\",\"url\":\"https:\/\/darko-keric.from.hr\/\",\"name\":\"Sistemski in\\u017eenjer\",\"description\":\"System administrator\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/darko-keric.from.hr\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/darko-keric.from.hr\/?p=381#webpage\",\"url\":\"http:\/\/darko-keric.from.hr\/?p=381\",\"name\":\"DHCP report powershell script - Sistemski in\\u017eenjer\",\"isPartOf\":{\"@id\":\"https:\/\/darko-keric.from.hr\/#website\"},\"datePublished\":\"2022-04-25T08:45:23+00:00\",\"dateModified\":\"2022-04-25T08:45:23+00:00\",\"author\":{\"@id\":\"https:\/\/darko-keric.from.hr\/#\/schema\/person\/5e2f76737b07a700e0e2a108d173e612\"},\"breadcrumb\":{\"@id\":\"http:\/\/darko-keric.from.hr\/?p=381#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/darko-keric.from.hr\/?p=381\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/darko-keric.from.hr\/?p=381#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/darko-keric.from.hr\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DHCP report powershell script\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/darko-keric.from.hr\/#\/schema\/person\/5e2f76737b07a700e0e2a108d173e612\",\"name\":\"darko-keric\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/darko-keric.from.hr\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"http:\/\/0.gravatar.com\/avatar\/0400800f6ebec266fcb39a1cb31b0b0e?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/0.gravatar.com\/avatar\/0400800f6ebec266fcb39a1cb31b0b0e?s=96&d=mm&r=g\",\"caption\":\"darko-keric\"},\"url\":\"http:\/\/darko-keric.from.hr\/?author=348\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/darko-keric.from.hr\/?p=381","og_locale":"en_US","og_type":"article","og_title":"DHCP report powershell script - Sistemski in\u017eenjer","og_description":"&nbsp; &nbsp; # Find all DHCP Server in Domain $DhcpServers = Get-DhcpServerInDC foreach ($DHCPServer in $DhcpServers.DnsName){ if (Test-Connection -BufferSize 32 -Count 1 -ComputerName $dhcpserver -Quiet){ $ErrorActionPreference = \u201cSilentlyContinue\u201d $Scopes = Get-DhcpServerv4Scope -ComputerName $DHCPServer #For all scopes in the DHCP server, &hellip; Continue reading &rarr;","og_url":"http:\/\/darko-keric.from.hr\/?p=381","og_site_name":"Sistemski in\u017eenjer","article_published_time":"2022-04-25T08:45:23+00:00","twitter_card":"summary","twitter_misc":{"Written by":"darko-keric","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/darko-keric.from.hr\/#website","url":"https:\/\/darko-keric.from.hr\/","name":"Sistemski in\u017eenjer","description":"System administrator","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/darko-keric.from.hr\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"WebPage","@id":"http:\/\/darko-keric.from.hr\/?p=381#webpage","url":"http:\/\/darko-keric.from.hr\/?p=381","name":"DHCP report powershell script - Sistemski in\u017eenjer","isPartOf":{"@id":"https:\/\/darko-keric.from.hr\/#website"},"datePublished":"2022-04-25T08:45:23+00:00","dateModified":"2022-04-25T08:45:23+00:00","author":{"@id":"https:\/\/darko-keric.from.hr\/#\/schema\/person\/5e2f76737b07a700e0e2a108d173e612"},"breadcrumb":{"@id":"http:\/\/darko-keric.from.hr\/?p=381#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/darko-keric.from.hr\/?p=381"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/darko-keric.from.hr\/?p=381#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/darko-keric.from.hr\/"},{"@type":"ListItem","position":2,"name":"DHCP report powershell script"}]},{"@type":"Person","@id":"https:\/\/darko-keric.from.hr\/#\/schema\/person\/5e2f76737b07a700e0e2a108d173e612","name":"darko-keric","image":{"@type":"ImageObject","@id":"https:\/\/darko-keric.from.hr\/#personlogo","inLanguage":"en-US","url":"http:\/\/0.gravatar.com\/avatar\/0400800f6ebec266fcb39a1cb31b0b0e?s=96&d=mm&r=g","contentUrl":"http:\/\/0.gravatar.com\/avatar\/0400800f6ebec266fcb39a1cb31b0b0e?s=96&d=mm&r=g","caption":"darko-keric"},"url":"http:\/\/darko-keric.from.hr\/?author=348"}]}},"_links":{"self":[{"href":"http:\/\/darko-keric.from.hr\/index.php?rest_route=\/wp\/v2\/posts\/381"}],"collection":[{"href":"http:\/\/darko-keric.from.hr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/darko-keric.from.hr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/darko-keric.from.hr\/index.php?rest_route=\/wp\/v2\/users\/348"}],"replies":[{"embeddable":true,"href":"http:\/\/darko-keric.from.hr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=381"}],"version-history":[{"count":1,"href":"http:\/\/darko-keric.from.hr\/index.php?rest_route=\/wp\/v2\/posts\/381\/revisions"}],"predecessor-version":[{"id":382,"href":"http:\/\/darko-keric.from.hr\/index.php?rest_route=\/wp\/v2\/posts\/381\/revisions\/382"}],"wp:attachment":[{"href":"http:\/\/darko-keric.from.hr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=381"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/darko-keric.from.hr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=381"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/darko-keric.from.hr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=381"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}