Microsoft Virtualization Discussions

Get Filer dns info

JGPSHNTAP

Guys,

Unless i'm totally missing it or brainfreeze, is there not an API for DNS info for the powershell toolkit.

Any help would be greatly appreciated.

1 ACCEPTED SOLUTION

JGPSHNTAP

Ah..rdfile.. no way.. I needed to do the following.. Check this out

<#
.SYNOPSIS
  Queries physical filers for dns info
.DESCRIPTION
 
  .EXAMPLE
  .\dns_check.ps1
.DATE
  05-20-2014
.Version
     v1
.Notes
  .Author
   Josh Goldfarb
.Change Log
      v1.0 - Initial
  

#>

cls

## Define Global PWD
$password = read-host "Enter Root password" -assecurestring
#$password = ConvertTo-SecureString "*" -AsPlainText -Force
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "root",$password

#Import filers
$dfmimport = import-csv \\filershare\dfmcontrollers.csv | Select controller

#Clear Screen
cls
$global = @()

$dfmimport |  % {


$filer = $_.controller.tolower()
Write-host "`n`tConnectiong to controller " $filer
$c = connect-nacontroller $filer -cred $cred -https -ea "silentlycontinue"
if ($c -ne $Null) {
## Gather DNS info
$i = invoke-nassh "dns info"
$new = $i.split("`n")
$ip = $new | ? {$_ -like "*10.*"}
$ip  = $ip -replace '\s+', ' '

$ip | % {
$s = $_.split(" ")

if ($s[1] -like "*no*") {
$info = "no info"
} else {
$info = $s[1]
}

$customobject = new-object psobject
  add-member -inputobject $customobject -membertype noteproperty -name Filer -value $filer
  add-member -inputobject $customobject -membertype noteproperty -name "Connection issue" -value ""
  add-member -inputobject $customobject -membertype noteproperty -name "IP Address" -value $s[0]
  add-member -inputobject $customobject -membertype noteproperty -name "Status" -value $info.tolower()
    $global += $customobject

}

} else {
$customobject = new-object psobject
  add-member -inputobject $customobject -membertype noteproperty -name Filer -value $filer
  add-member -inputobject $customobject -membertype noteproperty -name "Connection issue" -value yes
  add-member -inputobject $customobject -membertype noteproperty -name "IP Address" -value ""
  add-member -inputobject $customobject -membertype noteproperty -name "Status" -value ""
    $global += $customobject
}
clear-variable -name ip
}


$global | ft -autosize
$global | export-csv c:\temp\dnsinfo.csv -notypeinformation

View solution in original post

2 REPLIES 2

resqme914

I don't see any.  As an alternative, you could read the resolv.conf file with Read-NaFile.

JGPSHNTAP

Ah..rdfile.. no way.. I needed to do the following.. Check this out

<#
.SYNOPSIS
  Queries physical filers for dns info
.DESCRIPTION
 
  .EXAMPLE
  .\dns_check.ps1
.DATE
  05-20-2014
.Version
     v1
.Notes
  .Author
   Josh Goldfarb
.Change Log
      v1.0 - Initial
  

#>

cls

## Define Global PWD
$password = read-host "Enter Root password" -assecurestring
#$password = ConvertTo-SecureString "*" -AsPlainText -Force
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "root",$password

#Import filers
$dfmimport = import-csv \\filershare\dfmcontrollers.csv | Select controller

#Clear Screen
cls
$global = @()

$dfmimport |  % {


$filer = $_.controller.tolower()
Write-host "`n`tConnectiong to controller " $filer
$c = connect-nacontroller $filer -cred $cred -https -ea "silentlycontinue"
if ($c -ne $Null) {
## Gather DNS info
$i = invoke-nassh "dns info"
$new = $i.split("`n")
$ip = $new | ? {$_ -like "*10.*"}
$ip  = $ip -replace '\s+', ' '

$ip | % {
$s = $_.split(" ")

if ($s[1] -like "*no*") {
$info = "no info"
} else {
$info = $s[1]
}

$customobject = new-object psobject
  add-member -inputobject $customobject -membertype noteproperty -name Filer -value $filer
  add-member -inputobject $customobject -membertype noteproperty -name "Connection issue" -value ""
  add-member -inputobject $customobject -membertype noteproperty -name "IP Address" -value $s[0]
  add-member -inputobject $customobject -membertype noteproperty -name "Status" -value $info.tolower()
    $global += $customobject

}

} else {
$customobject = new-object psobject
  add-member -inputobject $customobject -membertype noteproperty -name Filer -value $filer
  add-member -inputobject $customobject -membertype noteproperty -name "Connection issue" -value yes
  add-member -inputobject $customobject -membertype noteproperty -name "IP Address" -value ""
  add-member -inputobject $customobject -membertype noteproperty -name "Status" -value ""
    $global += $customobject
}
clear-variable -name ip
}


$global | ft -autosize
$global | export-csv c:\temp\dnsinfo.csv -notypeinformation

View solution in original post

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public