-
-
Save mauroprojetos/de9593320192a72469ca13bc3c373f17 to your computer and use it in GitHub Desktop.
Revisions
-
kdaniel32 revised this gist
Dec 28, 2017 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,6 @@ # Get the IPv4 addresses of the VMs where the VMNetworkAdapter status is OK # presuming a single VmNIC on the VM # I need to check and see if the following is always true # $_.IPAddresses[0] is the IPv4 address # $_.IPAddresses[1] is the IPv6 address Get-VMNetworkAdapter -VMName * | Where-Object {$_.Status -eq “Ok”} | ForEach-Object {Write-Host $_.VMName ", " $_.IPAddresses[0]} -
kdaniel32 revised this gist
Dec 28, 2017 . No changes.There are no files selected for viewing
-
kdaniel32 created this gist
Dec 27, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ # Get the IPv4 addresses of the VMs where the VMNetworkAdapter status is OK # $_.IPAddresses[0] is the IPv4 address # $_.IPAddresses[1] is the IPv6 address Get-VMNetworkAdapter -VMName * | Where-Object {$_.Status -eq “Ok”} | ForEach-Object {Write-Host $_.VMName ", " $_.IPAddresses[0]} # Get the IPv4 addresses of the running VMs Get-VM | Where-Object {$_.State -eq “Running”} | Select -ExpandProperty NetworkAdapters | ForEach-Object {Write-Host $_.VMName ", " $_.IPAddresses[0]}