{"id":544,"date":"2014-09-02T11:33:01","date_gmt":"2014-09-02T11:33:01","guid":{"rendered":"http:\/\/giraffeit.com\/?p=544"},"modified":"2014-09-02T11:33:01","modified_gmt":"2014-09-02T11:33:01","slug":"dhcpexport","status":"publish","type":"post","link":"https:\/\/giraffeit.com\/index.php\/2014\/09\/02\/dhcpexport\/","title":{"rendered":"Powershell : export-dhcpserver"},"content":{"rendered":"<p><strong>Export\/Import existing scopes<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Export the DHCP scope ( whilst leaving active on source ) from SERVER\u00a0using either powershell or netsh<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Powershell commands:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Export-DhcpServer [-File] &lt;String&gt; [-CimSession &lt;CimSession&gt; ] [-ComputerName &lt;String&gt; ] [-Force] [-Leases] [-Prefix &lt;IPAddress[]&gt; ] [-ScopeId &lt;IPAddress[]&gt; ] [ &lt;CommonParameters&gt;]<\/p>\n<p>&nbsp;<\/p>\n<p>Example: export-dhcpserver -ComputerName SERVER\u00a0-file &#8220;C:PATHNAME.XML&#8221;<br \/>\nPre-Requisites for the PowerShell at that it is run on a windows 2012 server. The PowerShell will export it as an \u00a0XML file<\/p>\n<p>&nbsp;<\/p>\n<p>To import the scope ( note that using the import-dhcpserver it DOES NOT overwrite any existing scopes )<\/p>\n<p>&nbsp;<\/p>\n<p>Import-DhcpServer -file &#8220;C:PATHFILE.XML&#8221; -BackupPath &#8220;C:PATH&#8221;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>NetSh verison : <\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>This needs to be run on the server that holds the current DHCP scope that is being exported<\/p>\n<p>&nbsp;<\/p>\n<p>Netsh export c:tempdhcpdb all<\/p>\n<p><strong>\u00a0<\/strong><\/p>\n<p>I prefer using PowerShell as I have tried and tested it. However it wont work with Windows 2003 servers<\/p>\n<p>&nbsp;<\/p>\n<p>To import<\/p>\n<p>Copy the .txt file that was created earlier and<\/p>\n<p>&nbsp;<\/p>\n<p>netsh dhcp server import c:tempdhcp.txt all<\/p>\n<p>&nbsp;<\/p>\n<p>Again this will NOT overwrite existing scopes. Refresh the window if it doesn\u2019t appear.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Export\/Import existing scopes &nbsp; Export the DHCP scope ( whilst leaving active on source ) from SERVER\u00a0using either powershell or netsh &nbsp; Powershell commands: &nbsp; Export-DhcpServer [-File] &lt;String&gt; [-CimSession &lt;CimSession&gt; ] [-ComputerName &lt;String&gt; ] [-Force] [-Leases] [-Prefix &lt;IPAddress[]&gt; ] [-ScopeId &lt;IPAddress[]&gt; ] [ &lt;CommonParameters&gt;] &nbsp; Example: export-dhcpserver -ComputerName SERVER\u00a0-file &#8220;C:PATHNAME.XML&#8221; Pre-Requisites for the PowerShell at &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/giraffeit.com\/index.php\/2014\/09\/02\/dhcpexport\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Powershell : export-dhcpserver&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-544","post","type-post","status-publish","format-standard","hentry","category-bog"],"_links":{"self":[{"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/posts\/544","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/comments?post=544"}],"version-history":[{"count":0,"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/posts\/544\/revisions"}],"wp:attachment":[{"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/media?parent=544"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/categories?post=544"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/tags?post=544"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}