Thaidog
asked on
Need a powercli script to search for VM by subnet
I have the following script to search for VM by ip address:
But I need one to search for all VMs on a particular subnet... could this script be modified to do so?
$tgtIP = "172.25.xxx.xxx"
$vms = Get-VM
foreach($vm in $vms){
$vmIP = $vm.Guest.IPAddress
foreach($ip in $vmIP){
if($ip -eq $tgtIP) {
Write-Host "Found the VM!"
$vm.Name
}
}
}
But I need one to search for all VMs on a particular subnet... could this script be modified to do so?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.