- Part 1 : Windows Server 2012 R2 Installation.
- Part 2 : Exploring PowerShell Default Settings.
- Part 3 : Getting and setting server name.
Part - 4 { Information - IP Addresses}
In our pervious blog post, we have learned, that how can we get and set the name of "Windows 2012" server.
Now, our next step is to find the IP Address of our current server and change it according to our requirements.
In "Windows Server 2012" we have a nice set of PowerShell modules, those deals with networking stuff. We can use the Get-Module cmdlet, to get the list of all modules, whose names start with NET.
Get-Module -ListAvailable *net*
Getting current IP Address (the old way).
There are several ways to get the current IP Address of the server. We can get it by using WMI, external commands, and using PowerShell too.
- By using ipconfig
- ipconfig / all
- By using netsh command
- netsh interface ip show config name="Ethernet"
- By using WMI Query
Get-WmiObject -Query "SELECT IPAddress FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'True'"
Getting current IP Address (the new way).
Ok, we all knows, that PowerShell is a object based language, and it's so cool, in Windows 2012, we have a amazing, nice cmdlet which give us the information of current IP Address. The cmdlet is called, Get-NetIPConfiguration
Just runt the above cmdlet and it will give you all the information related of our IP-address.
Cool , No? In the next blog post, we will see about setting IP-Address using PowerShell. Till then take care.
Aman Dhally
If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube” channel for PowerShell video tutorials. You can download all of my scripts from “Microsoft TechNet Gallery”.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.