Winapi 如何使用API或PowerShell在Windows Server 2008上添加新的DNS区域?
在Winapi 如何使用API或PowerShell在Windows Server 2008上添加新的DNS区域?,winapi,powershell,windows-server-2008,wmi,Winapi,Powershell,Windows Server 2008,Wmi,在Microsoft DNS Server 2008中是否有任何API可以使用VBScript或PowerShell或p/Invoke或WMI添加新的转发DNS? 生成纯文本文件并将其放入\system32\dns很容易 如何用一个脚本执行来替换MMC中的大量手动命令 #xyz is dns servername $A = [wmiclass]"\\xyz\root\MicrosoftDNS:MicrosoftDNS_AType" $DNSServer = "xyz.R-test.com"
Microsoft DNS Server 2008
中是否有任何API可以使用VBScript
或PowerShell
或p/Invoke
或WMI
添加新的转发DNS
?
生成纯文本文件并将其放入\system32\dns
很容易
如何用一个脚本执行来替换MMC
中的大量手动命令
#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
…