PowerShell has the ability to perform so many functions, from WMI queries to fetching information etc. On Windows Server Core, whether it is Windows Server 2022, 2019 2016, because many of the GUI features are not available, you cannot just open a browser to do something for example.

In my lab, I was interested to see what Public IP I was getting and I was able to achieve this with a one-liner cmdlet as follows:

Invoke-WebRequest ifconfig.me/ip -usebasicparsing

Because IE modules are not loaded, the last switch -usebasicparsing is included but it gives you the information required as shown in the Figure below:

Powershell:- finding your public ip on server core

Under the “Content” section, this is where you will find the information. Obviously there are other ways to find this kind of information, all depends on the OS version and how much access to the internet you have.

Hope it helps.

    wpChatIcon

    Discover more from Everything-PowerShell

    Subscribe now to keep reading and get access to the full archive.

    Continue reading