Saturday, March 5, 2016

VMware PowerCLI find vm parent folder

clear
$folderid=get-vm -name tech-jockey-vm1,tech-jockey-vm2,tech-jockey-vm3 |select name

foreach($vmn in $folderid)
{
$folderparent=get-view $vmn
$p=get-view $folderparent.Parent
$pp=get-view $p.Parent |select name
write-host "VMname :" $vmn.Name.ToString() ":" "Child Folder :"  $p.Name  ":" "Parent Folder :" $pp.Name
}

No comments:

Post a Comment

Thanks for showing interest in tech-jockey.

Content of this blog has been moved to GITHUB

Looking at current trends and to make my content more reachable to people, I am moving all the content of my blog https://tech-jockey.blogsp...