qshinoの日記

Powershell関係と徒然なこと

windows dnsサーバー

DNSサーバーをpowershellから設定したいので、まずは関連情報を収集。

DnsShellを利用

  1. DnsShell Module install
  2. ServerManager Module Install
  3. Zone登録
  4. ホスト=Aレコード登録
  5. 逆引きPTRレコード登録

DnsShell Module Install

Import-Module DnsShell
Get-Command -Module DnsShell

ServerManager Module Install

Import-Module ServerManager;
Add-WindowsFeature DNS;
Add-WindowsFeature NET-Framework;

Primary Zone 追加

New-DnsZone -ZoneName example.jp -ZoneType Primary

Primary Zone削除

Get-DnsZone -Name "ゾーン名" | Remove-DnsObject

例)example.jp ゾーンを削除します。

Get-DnsZone -Name example.jp | Remove-DnsObject

逆引きゾーン登録

逆引き参照ゾーンに 1.1.1.in-addr.arpa という名前でプライマリゾーンを作成。

New-DnsZone -ZoneName 1.1.1.in-addr.arpa -ZoneType Primary

ホスト名=Aレコード登録

ホスト名 www で、アドレスを 1.1.1.1 に設定するAレコードを作成。

New-DnsRecord -RecordType A -Name www -IPAddress 1.1.1.1 -ZoneName example.jp

Aレコード削除

作成したレコードを削除するには、下記の様な感じで削除できます。

Get-DnsRecord -Name "レコード名" -ZoneName "ゾーン名" | Remove-DnsObject

例)MXレコード削除

Get-DnsRecord -Name example.jp -RecordType MX -ZoneName example.jp | Remove-DnsObject

DnsShell記事

詳しい事は此方で。 http://blogs.gine2.jp/kusa/archives/8

MSDN/powershell

https://msdn.microsoft.com/ja-jp/library/dn593645(v=ws.11).aspx

technet/powershell

https://technet.microsoft.com/en-us/library/jj649850.aspx

普通にAD&DNS

http://www.atmarkit.co.jp/ait/spv/1305/10/news001_2.html

Q&A

http://itpro.nikkeibp.co.jp/article/COLUMN/20080326/297134/?ST=spleaf