Posted On May 21, 2020

PowerShell: Resolving URL to Public IP

kimconnect 0 comments
blog.KimConnect.com >> Codes >> PowerShell: Resolving URL to Public IP
# URL can be with http, https, full paths, or just domain
$url='https://google.com/domains'

# This will return the position 0 public IP of the provided URL's domain
$regexDomain='(http[s]:\/{2}){0,1}([\d\w\.-]+)\/{0,1}'
$domain=.{[void]($url -match $regexDomain);$matches[2]}
$publicIP=[System.Net.Dns]::GetHostAddresses($domain)[0].IPAddressToString
write-host $publicIP

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

How to Restart Domino Services without Reboot

--------------Restart_Domino.bat------------------------------------------------------net stop "Lotus Domino Server (LotusDominoData)"c:\bats\pulist | findstr /I /C:"nadminp.exe" >c:\bats\pid.lstc:\bats\pulist | findstr /I /C:"naldaemn.exe"…

PowerShell: Fix All VMs CPU Compatibility Setting

# fixAllVmCpuCompatibility.ps1 # version 0.01 function getHyperVHostsInForest{ function includeRSAT{ $ErrorActionPreference='stop' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 #$rsatWindows7x32='https://download.microsoft.com/download/4/F/7/4F71806A-1C56-4EF2-9B4F-9870C4CFD2EE/Windows6.1-KB958830-x86-RefreshPkg.msu' $rsatWindows7x64='https://download.microsoft.com/download/4/F/7/4F71806A-1C56-4EF2-9B4F-9870C4CFD2EE/Windows6.1-KB958830-x64-RefreshPkg.msu'…

PowerShell: Automating Dynamics CRM Migration

This is the source code that has been used to move hundreds of Dynamics CRM…