Multi-homed server, a server with multi-services and is set with different IPs is quite common if there is a budget constraint. It is always good to have a dedicated server do a single function provided there is enough luxury to do it.
So if you just inherited the network and all the servers in your environment have documentation which is poor to nothing, then pray hard that nothing will happen until you have it under control by proper documentation and familiarization.
It's quite tough to troubleshoot when a problem arises if no proper documentation to depend on and there will be a lot of surprises as the work journey goes on.
Listing or getting the IP Addresses on your entire server and having a proper documentation will definitely help and ease the tension during some issues.
It’s also easy to troubleshoot during a network outage or other circumstances that may arise.
Listing the IP Address of a server can be done in different ways.
Doing it remotely is quite convenient and of course with the help of PowerShell that makes life easier for Sys Ads.
PowerShell script below will get or list the IP Addresses configured on a server.
To use the script, the input parameter can either be a hostname or a single IP Address on the server.
If you only know a single IP Address configured on the server but don't know the hostname or other IP Addresses set on the server, the script below just need one IP and will list other IPs set on the server.
Here's the script:
#$ip - can either be hostname or IP Address
#$ip="192.168.100.1"
$ip="D_Free_Server"
$result = [System.Net.Dns]::gethostentry($ip) | Foreach-Object { write-host $_.AddressList }
Run the script on PowerShell ISE to test, if the queried IP Address or hostname has multiple IP addresses set on the NICs all IPs will be displayed.
Script above can also be written like this script below:
#$ip - can either be hostname or IP Address
#$ip="192.168.100.1"
$ip="D_Free_Server"
$result = [System.Net.Dns]::gethostentry($ip) |select-Object { $_.AddressList }
$result
The issue with the above script the result is truncated and ellipsis is shown, therefore the data is incomplete.
As a workaround for this scenario, use write-host as used on the first script above.
Example script above can also get the hostname by querying the IP Address of the server.
Here's the PowerShell script:
$ip="192.168.100.1"
$result = [System.Net.Dns]::gethostentry($ip) |select-Object { $_.HostName }
$result #<
PowerShell script above gets the hostname of the server by querying the IP Address.
That's it guys till next time.
Hope the example above will boil your motivation to get your hands wet to learn PowerShell.
============================================
Linux Android App cheat sheet:
https://play.google.com/store/apps/details?id=com.LinuxMobileKit
Free Android Apps:
Click on links below to find out more:
https://play.google.com/store/apps/details?id=soulrefresh.beautiful.prayer
Catholic Rosary Guide for Android:
https://play.google.com/store/apps/details?id=com.myrosaryapp
http://quickbytesstuff.blogspot.sg/2014/09/how-to-recite-rosary.html
Divine Mercy Chaplet Guide (A Powerful prayer):
https://play.google.com/store/apps/details?id=com.dmercyapp
Educational Android App for Kids:
https://play.google.com/store/apps/details?id=com.xmultiplication
https://play.google.com/store/apps/details?id=com.letsmultiply
Comments
Post a Comment