【问题标题】:How to add new DNS zone on Windows Server 2008 using API or PowerShell?如何使用 API 或 PowerShell 在 Windows Server 2008 上添加新的 DNS 区域?
【发布时间】:2009-09-17 19:35:06
【问题描述】:

Microsoft DNS Server 2008 中是否有任何 API 可以使用 VBScriptPowerShellP/InvokeWMI 添加新的转发 DNS? 很容易生成纯文本文件并放入\system32\dns

如何用脚本执行替换MMC中的一些手动命令?

【问题讨论】:

    标签: winapi powershell windows-server-2008 wmi


    【解决方案1】:
    #xyz is dns servername
    
    $A = [wmiclass]"\\xyz\root\MicrosoftDNS:MicrosoftDNS_AType"
    
    $DNSServer = "xyz.R-test.com"
    $Zone = "R-Test.com"
    $class = 1
    $TTL = 3600
    
    #This is your web server IP Address
    $IPAddress = "192.168.1.88"
    
    $Sites = Get-content WebSites.txt
    
    Foreach ($Site in $Sites)
    {
    $A.CreateInstanceFromPropertyData($DNSserver, $zone, $Site, $class, $ttl, $IPAddress)
    }
    
    The WebSites.txt is something look like this:
    whatever1.R-test.comwhatever2.R-test.comwhatever3.R-test.com
    
    whatever4.R-test.com
    
    …
    

    http://www.highorbit.co.uk/?p=636

    http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!994.entry

    http://myitforum.com/cs2/blogs/yli628/archive/2008/06/19/powershell-script-to-add-multiple-a-records-in-dns.aspx

    【讨论】:

      猜你喜欢
      • 2018-08-09
      • 2010-09-23
      • 1970-01-01
      • 2012-06-01
      • 1970-01-01
      • 2012-04-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多