Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Winapi 如何使用API或PowerShell在Windows Server 2008上添加新的DNS区域?_Winapi_Powershell_Windows Server 2008_Wmi - Fatal编程技术网

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

…