Follow sqlserver-dba.com

Subscribe to RSS feed  Follow @jackvamvas - Twitter

*Use the Comments section for questions

SQLServer-DBA.com Links

Dba_db2_button

dba-ninja.com

SQL Server DBA Jobs

How to Get FQDN – Hostname and IP address with Powershell

22 January,2013 by Tom Collins

Question: How can I obtain the Fully Qualified Domain Name (FQDN) of the local and remote servers  using Powershell? 

how can I obtain the IP address of the server?

Answer: In powershell there are a number of different methods. The most effective  is using the System.Net.Dns class.  These examples illustrate the ease of use to obtain FQDN and IP address for local and remote servers.

 

#Get the FQDN of the local server
"$env:computername.$env:userdnsdomain"

#Get the FQDN of the local server
[System.Net.Dns]::GetHostByName(($env:computerName))

#Get the FQDN of the IP address  for remote server
[System.Net.Dns]::GetHostByName("server1")
[System.Net.Dns]::GetHostByName("server2")

#Get the IP address of the FQDN
[System.Net.Dns]::GetHostAddresses("server3")

 

To get FQDN of multiple servers - How to get FQDN of multiple servers with Powershell

 

Read More

Powershell List all Patches Updates on a Server - SQL Server DBA

How to check Operating System type with Powershell - SQL Server ...

Powershell sql server security audit - SQL Server DBA


Author: Tom Collins (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on How to Get FQDN – Hostname and IP address with Powershell


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer