Set DNS server properties

Set DNS server properties

Set DNS server properties
[quote]
# From the book "Active Directory, Third Edition"
# ISBN: 0-596-10173-2

use Win32::OLE;

$objDNS = Win32::OLE->GetObject('winMgmts:root\\MicrosoftDNS');
$objDNSServer = $objDNS->Get('MicrosoftDNS_Server.Name="."');

print $objDNSServer->Name . ':', "\n";
$objDNSServer->{EventLogLevel} = 4;
$objDNSServer->{LooseWildcarding} = 1;
$objDNSServer->{MaxCacheTTL} = 900;
$objDNSServer->{MaxNegativeCacheTTL} = 60;
$objDNSServer->{AllowUpdate} = 3;
$objDNSServer->Put();

if ((0 + Win32::OLE::LastError())) {
print ' Error occurred: ' . ('' . Win32::OLE::LastError()), "\n";
}
else {
print " Change successful\n";
}
print "The script has completed successfully.\n";


[/quote]
上面这段程序是我在一个外文网上看到的.修改dns的.但是我在调试却不能成功.呵呵.因为是新手,转过来看看哪位兄弟会帮忙修改下的.
直接用bind9的dns--那个.
直接用bind9的dns
那个方便,自己设定一个key
然后调用Net::DNS模块
就可以操作dns了
[CCB]10[/CCB]楼上兄弟,能.
[CCB]10[/CCB]楼上兄弟,能否给个例子???偶对这个不是很了解哦
有 netsh 的 win 系统上调.
有 netsh 的 win 系统上调用 netsh 命令来指定 dns 也可以
[quote]netsh interface ip set dns name = "本地连接" source = static addr = 202.103.96.112[/quote]