Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Dynamically get Hyper-V Servers, get all the VM dns names

$
0
0

Has anyone Idea?

I'm working for hours on this but I'm not getting anywhere.

foreach($system in $systems){
        $hyperv = invoke-command $system.DNSHostName -ScriptBlock {get-windowsfeature | Where {$_.name -match "Hyper-V"} | where {$_.installed -match $true}}
}

$system.dnshostname gets every dnshostname of all the systems in the AD. But I don't know how to get only the ones with installed hyper-v features.

The way it is written I actually inly can information about the filtered features, like feature name...

I also still couldn't find a way to get from the VMs the name. get-vm delivers the VM name which isn't always the same as the DNS name.


Viewing all articles
Browse latest Browse all 21975

Trending Articles