Created
September 30, 2014 01:22
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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