Quantcast
Viewing all articles
Browse latest Browse all 231887

Re: VMs status in the list

You mean something like this ?

Get-Content-PathC:\vmnames.txt|
Select@{N="VMname";E={$_}},
 
@{N="Status";E={
   
$vm=Get-VM-Name$_-ErrorActionSilentlyContinue
   
if($vm){$vm.PowerState}else{"Not found"}
  }}
 

The vmnames.txt file is assumed to have 1 name per line


Viewing all articles
Browse latest Browse all 231887

Trending Articles