Skip to content

Instantly share code, notes, and snippets.

@BrendanThompson
Created September 30, 2014 01:22
Show Gist options
  • Save BrendanThompson/cd72195b9fbcaf4f9978 to your computer and use it in GitHub Desktop.
Save BrendanThompson/cd72195b9fbcaf4f9978 to your computer and use it in GitHub Desktop.
Compare two host names to confirm if they return the same IP Address
function compareHost() {
param
(
[Parameter(Mandatory=$true)]
[string] $firstHost,
[Parameter(Mandatory=$true)]
[string] $secondHost
)
if($((Test-Connection $firstHost -Count 1).IPV4Address.IPAddressToString) -eq $((Test-Connection $secondHost -Count 1).IPV4Address.IPAddressToString)) {
Write-Host "Host IP Addresses Match!"
} else {
Write-Warning "Host IP Addresses do not match."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment