Check if multiple nics are set to register with DNS: Difference between revisions

From roonics
Jump to navigation Jump to search
(Created page with "test")
 
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
test
This checks all the nics on a server to see if multiple nics have the "Register this in DNS" which if multiple are selected it can cause connectivity issues.
 
1.  Export a list of the servers you wish to check and save it as a txt file in the same location as the script called "computers.txt" as below:
 
<pre>
server01
server02
server03
server04
</pre>
 
2.  Copy and paste the below script in to Notepad and save it as a ps1 file:
 
<pre>
cls
$servers = Get-Content computers.txt
 
foreach($server in $servers)
 
{
 
$nics = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName $server -ErrorAction Inquire | Where{$_.IPEnabled -eq "TRUE"}
 
foreach($nic in $nics)
{
Write-Host $server "-" $nic.IPAddress "-" $nic.FullDNSRegistrationEnabled
}
}</pre>
 
3.  Now run the script.
 
Example output:
<pre style="color: white; background: #012456; width: 800px">
server01 - 10.10.10.10 - True
server01 - 192.168.0.1 - False
server02 - 10.10.10.20 - True
server03 - 10.16.10.30 - True
 
</pre>
 
 
 
 
[[Category:PowerShell]]
[[Category:scripts]]
‎<comments />

Latest revision as of 10:03, 20 March 2022

This checks all the nics on a server to see if multiple nics have the "Register this in DNS" which if multiple are selected it can cause connectivity issues.

1. Export a list of the servers you wish to check and save it as a txt file in the same location as the script called "computers.txt" as below:

server01
server02
server03
server04

2. Copy and paste the below script in to Notepad and save it as a ps1 file:

cls
$servers = Get-Content computers.txt

foreach($server in $servers)

{

 $nics = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName $server -ErrorAction Inquire | Where{$_.IPEnabled -eq "TRUE"}

	foreach($nic in $nics)
	{
	Write-Host $server "-" $nic.IPAddress "-" $nic.FullDNSRegistrationEnabled
	}
}

3. Now run the script.

Example output:

server01 - 10.10.10.10 - True
server01 - 192.168.0.1 - False
server02 - 10.10.10.20 - True
server03 - 10.16.10.30 - True

‎<comments />