zoukankan      html  css  js  c++  java
  • 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服务器授权

  • 相关阅读:
    JVM调优
    【转】中文分词之HMM模型详解
    xwiki enterprise 8.4.5使用https步骤
    dubbo和shiro的整合,在服务端做权限验证
    电商课题:分布式锁
    Export large data from Gridview and Datareader to an Excel file using C#
    sap学习笔记
    git拉取远程分支并创建本地分支
    Echarts 解决饼图文字过长重叠的问题
    用localStorage坚持Vuex状态----vuex-persistedstate
  • 原文地址:https://www.cnblogs.com/dreamer-fish/p/4900681.html
Copyright © 2011-2022 走看看