save the following code to c:\backup-dhcp-db.bat
set backuplocation=\\SharedFolder\backups\dhcp
@ECHO OFF
REM ====================================================================
netsh dhcp server \\%computername% export c:\backup\dhcpdb.backup all
net use o: %backuplocation%
echo f|xcopy C:\backup\dhcpdb.backup o:\%computername%\%DATE:~-2%-%DATE:~4,2%-%DATE:~7,2%-dhcpdb.backup /y /e
o:
cd %computername%
setlocal
set /a cnt=0
set "keep=60"
for /f "eol=: delims=" %%F in ('dir /b /o-d *.backup') do (
if defined keep (
2>nul set /a "cnt+=1, 1/(keep-cnt)" || set "keep="
) else del "%%F"
)
c:
net use o: /d /y
For restore backup to the DHCP:
dhcp server \\servername import c:\backup\dhcpdb.backup all
Network And Information Technology Team: Backup And Restore Dhcp Db Server Batch File >>>>> Download Now
ReplyDelete>>>>> Download Full
Network And Information Technology Team: Backup And Restore Dhcp Db Server Batch File >>>>> Download LINK
>>>>> Download Now
Network And Information Technology Team: Backup And Restore Dhcp Db Server Batch File >>>>> Download Full
>>>>> Download LINK Bv