PoshCode Archive  Artifact [198be50524]

Artifact 198be5052467ba65cc243b115c2c825fdf133daf1d5d3105751f77cee9b0a63f:

  • File Get-DNSZoneRecords.ps1 — part of check-in [f0e55a7474] at 2018-06-10 14:15:22 on branch trunk — This Script was written to query remote DNS servers for A record in the local domain. I wrote this in CTP 2 and unsure if it will work in Posh v1. (user: unknown size: 1321)

# encoding: ascii
# api: powershell
# title: Get-DNSZoneRecords
# description: This Script was written to query remote DNS servers for A record in the local domain. I wrote this in CTP 2 and unsure if it will work in Posh v1.
# version: 0.1
# type: class
# license: CC0
# x-poshcode-id: 642
# x-archived: 2008-10-27T18:23:18
#
#
#==========================================================================
#
# NAME: Get-DNSZoneRecords.ps1
# AUTHOR: Saehrig, Steven (trac3r726)
# DATE  : 10/17/2008
# @@Requires PSHX-Sapien to be loaded for the Read-inputbox cmdlet.
# @@Requires Powershell CTP 2
#
# COMMENT: 
# Just comment out the variable and enter the info you need for 
# computername, dnszonename, and remove the credential portion if not needed.
# Otherwise on Execution you will be prompted for credentials and IP.
#==========================================================================


$cred = Get-Credential
$computer = read-inputbox "Enter Server ip"
$zonename = Get-WmiObject Win32_computersystem -computerName $computer -credential $cred
$dnszonename = $zonename.domain

get-wmiobject -namespace "root\microsoftdns" -class microsoftdns_atype -computername $computer -credential $cred -filter "containername='$dnszonename'" | ft  dnsservername, ownername, recorddata, ttl