Created
September 26, 2012 17:17
-
-
Save Iristyle/3789289 to your computer and use it in GitHub Desktop.
Hyper-V IP addresses
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
$vmParams = @{ | |
NameSpace = 'Root\Virtualization'; | |
Query = 'SELECT * FROM Msvm_KvpExchangeComponent' #pulls VM WMI object ExchangeComponents | |
} | |
Get-WmiObject @vmParams | | |
% { | |
$xml = [Xml]"<properties>$($_.GuestIntrinsicExchangeItems)</properties>" | |
$xml.properties.INSTANCE.Property | | |
% { | |
$value = ($_.ParentNode.Property | ? { $_.Name -eq 'Data' }).VALUE | |
if ($_.Value -eq 'FullyQualifiedDomainName') | |
{ | |
Write-Host "Host: $($value)" | |
} | |
if ($_.Value -eq 'RDPAddressIPv4') | |
{ | |
Write-Host "RDP Address: $($value)" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment