• DHCP服务器备份、还原、迁移


    备份DHCP服务器

    $today = get-date
    $todayu = get-date -format 'yyyyMMdd'
    #备份DHCP数据库,用于还原到本地
    Backup-DhcpServer -ComputerName dhcp1.uxin.youxinpai.com -Path C:Windowssystem32dhcpackup
    #导出DHCP配置,恢复的时候,只用Import-DhcpServer即可,可以恢复到新DHCP服务器
    Export-DhcpServer -ComputerName dhcp1.uxin.youxinpai.com -File C:Backupdhcp1_export_$todayu.xml
    
    xcopy.exe /s /y C:Backupdhcp1_export_$todayu.xml \192.168.200.249D$BackupDHCP_Export
    xcopy.exe /s /y C:Windowssystem32dhcpackup \192.168.200.249D$BackupDHCP_Backup

    清除早于14天的数据

    #清除DHCP服务器的备份文件:删除早于14天的备份文件
    $Files = Get-ChildItem –Path D:BackupDHCP_Backup
    Foreach ($file in $Files)
    {
     If (((get-date) - $file.lastwritetime).days -gt 14)
         {Remove-Item $file.Fullname -Force -Recurse}    
    }
    
    $Files2 = Get-ChildItem –Path D:BackupDHCP_Export
    Foreach ($file2 in $Files2)
    {
     If (((get-date) - $file2.lastwritetime).days -gt 14)
         {Remove-Item $file2.Fullname -Force}    
    }

    Restore-DhcpServer -ComputerName dhcpserver.contoso.com -Path C:Windowssystem32dhcpackup

    Import-DhcpServer -ComputerName dhcpserver.contoso.com -File C:exportsdhcpexport.xml -BackupPath C:dhcpbackup

    参考:https://technet.microsoft.com/zh-cn/library/jj553823.aspx

    迁移DHCP服务器:

    原DHCP服务器宕后恢复步骤:
    1.设置当前DHCP服务为自启动
    2.Import-DHCPServer -ComputerName NEWDHCP02.uxin.youxinpai.com -File D:BackupDHCP_Exportdhcp1_export_20160124.xml -Verbose -BackupPath C:dhcp02backup #导入DHCP配置到当前DHCP服务器,并对当前DHCP进行备份
    3.撤销原DHCP服务器授权
    4.对当前DHCP服务器授权

  • 相关阅读:
    一个强大的在线开发IDE: CodeRun Studio
    PyQuery: 一个类似jQuery的Python库
    jQuery的图片剪切插件
    SVN导出两个版本之间的差异文件
    javascript中的focus()光标定位
    零分,裸奔真危险
    Django 截取中英文混合字符串
    360与金山网盾
    20100301:IE6的葬礼
    两个与jQuery相关的资源:导航条与提示
  • 原文地址:https://www.cnblogs.com/dreamer-fish/p/4900681.html
Copyright © 2020-2023  润新知