Help with the script to add additional method

Could you please help me with the script below. I need to add a line that would check TCP/IP Settings option for DNS -“Register this connection’s addresses in DNS” and output the results if that option is set to true or false.

Thank you very much.

Script for network settings

      param (

foreach ( $Computer in $arrComputer ) {
    Get-WmiObject -ComputerName $Computer Win32_NetworkAdapterConfiguration |
     Where-Object { $_.IPAddress -ne $null } |
     Select-Object @{n="Name";e={$_.DNSHostName}},
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dan McFaddenSystems EngineerCommented:
Just add the following to the object you are building:

@{n="Register this connection’s addresses in DNS";e={$_.FullDNSRegistrationEnabled}}

Open in new window

Though I suspect that you may run into issues with the IPAddress, IPSubnet, DefaultIPGateway & DNSServerSearchOrder if you have a computer with more than 1 IP address assigned.

As an aside:  I don't get why you are building a parameter as an array with 1 value in it and then looping thru the array as if there were many objects in the array?  Is this a piece of a script or the entire script?

Here is how I would do it if I had to run this command against several computers:

$ComputerList = Get-Content Get-NicInfo.txt
$OutputFile = "Get-NicInfo-Report.csv"
$Output = @()

foreach ($Computer in $ComputerList)
	Write-Host "Working on device : $Computer"
	$NicInfo = Get-WmiObject -ComputerName $Computer Win32_NetworkAdapterConfiguration | Select * | Where {$_.IPEnabled -eq "True"}
	$ninfo = New-Object PSObject
	$ninfo | Add-Member -MemberType NoteProperty -Name  "DNSHostName" -Value ($NicInfo.DNSHostName -join '; ')
	$ninfo | Add-Member -MemberType NoteProperty -Name  "Description" -Value ($NicInfo.Description -join '; ')
	$ninfo | Add-Member -MemberType NoteProperty -Name  "IPAddress" -Value ($NicInfo.IpAddress -join '; ')
	$ninfo | Add-Member -MemberType NoteProperty -Name  "IPSubnet" -Value ($NicInfo.IPSubnet -join '; ')
	$ninfo | Add-Member -MemberType NoteProperty -Name  "DefaultIPGateway" -Value ($NicInfo.DefaultIPGateway -join '; ')
	$ninfo | Add-Member -MemberType NoteProperty -Name  "DNSServerSearchOrder" -Value ($NicInfo.DNSServerSearchOrder -join '; ')
	$ninfo | Add-Member -MemberType NoteProperty -Name  "FullDNSRegistrationEnabled" -Value ($NicInfo.FullDNSRegistrationEnabled -join '; ')
	$Output += $ninfo
$Output | Export-Csv $OutputFile  -NoTypeInformation -UseCulture

Open in new window

I the "Get-NicInfo.txt" text file, just put the computer names, one per line, into the file.  Like so:


The script will read in all the lines to a list of values, then loop thru that list, store the info for each computer in the list, in an object, then... when finished, write the information collected into a file named "Get-NicInfo-Report.csv"


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
creative555Author Commented:
This is awesome!! Very nice export.csv with exactly what I need. Thank you so much!!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.