Microsoft has wunderfull products, and Windows Server 2003 is one of them.  For some purposes I find it even better then the Windows 2008 version, but that's another story. Stable as it is, the R2 version a bit more, I can recomment the use of it to anyone. It's cheaper that W2K8 and that also counts today. Why buy a new license when you allready have one. The only real problem is that the normal W2K3 version will be end-of-life soon. In this article I like to share with you, a handy export command-line to export and import a dhcp scope, as well as a readable copy of it. You can use these command in Windows Server 2008 as well.


Logon to a server which as the dhcp scope running. in most environments there a 2 scopes, one active and one stand-by. Why exporting a copy of the scope. There can be several reasons. If you have a complicated dhcp scope, you should always make an extra copy instead of trusting your backup. Secondly, it is very handy to use the export as a start of building the secondary dhcp scope, which you can create while the scope is inactive. And last but not least, you can use the readable option for documentation, or as a hand-out to your accountant for instance. Both export type can be done by using a netsh command.


Now how are you going to do this:

A) Create a non-readable dhcp export.
Logon with administrative rights and open a command prompt. type in the following command:
netsh dhcp server \\SERVERNAME export d:\backup_DHCP_servername all
This way you create a full backup of the scope which you can youse for import or extra backup reasons.
If you would like to save/export the scopes every month, you can use the date parameter as wll in the name.
Create a scheduled job which contains the command:
netsh dhcp server \\SERVERNAME export "d:\backup_DHCP_servername%DATE%" all
In this scenario you can always rollback to a certain point in time, regardless the backup or other difficulties.

B) Create a readable dhcp export.
Now this works almost the same as an export, but the format is different (ASCI), so it can be read, but you cannot use this but import reasons.
The command is slightly different and is now:
netsh dhcp server \\SERVERNAME dump all > d:\backup_DHCP_servernamedump.txt
opening this file in notepath.exe for example will supply you with a readable scope export. 


General considerations:
- If you are running this command from the dhcp server itself, you can leave out the \\SERVERNAME
- Importing a scope in a (secondary) scope can be done with the "IMPORT" option. Use /? or help for the syntax.
   (easy, allmost the same as exporting it)
- You can automate both options for fast and auto-discovery reasons through batchfiles or a centralized database.



Hope this will help you creating a more stable environment. You will be happy you did it, when you lose a dhcp-scope!


Printscreen: Not available



-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Ben OostdamBen Oostdam has been working with Windows systems since 1993. Worked for several companies as a system administrator, and is currently a Senior Support Engineer for a large company in the Netherlands.

Disclaimer: The information contained in this website/article is for general information purposes only. The information is provided as is, by Ben Oostdam and while we endeavour to keep the information up to date and correct, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the website for any purpose. Any reliance you place on such information is therefore strictly at your own risk. In no event will we be liable for any loss or damage including without limitation, indirect or consequential loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in connection with, the use of this website. Through this website you are sometimes able to link to other websites which are not under my control. I have no control over the nature, content and availability of those sites. The inclusion of any links does not necessarily imply a recommendation or endorse the views expressed within them. Every effort is made to keep the website up and running smoothly. However, I take no responsibility for, and will not be liable for, the website being temporarily unavailable due to technical issues beyond our control. All entries in these articles, are my individual opinion, or from co-writers and they don't necessary reflect the opinion of my employer.




 

Wednesday the 17th, July 2019. All rights reserved.. // Oostdam WebDesign