vespavbb
Enthusiast
Enthusiast

get-vm from default folder vm non recursive

Jump to solution

hi,

some how it looks difficult to get a list of vm´s which are in the default hidden folder 'vm'

I want to have a list of vm´s which are not in any folder, 

Get-VM -Location (Get-Folder  -Name 'vm'-Location (Get-Datacenter -Name 'dc1') | where-object {$_.Name -eq 'vm'}) 

this command for example  will always list vm´s which are included in subfolders. 

How can I do that?

Thanks

 

 

VCP4,VCP5,VCP6
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership

Use the NoRecursion switch

Get-Datacenter -Name dc1 | Get-Folder -Name vm | Get-VM -NoRecursion


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
1 Reply
LucD
Leadership
Leadership

Use the NoRecursion switch

Get-Datacenter -Name dc1 | Get-Folder -Name vm | Get-VM -NoRecursion


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos