Hello,
What's the simplest syntax for using "foreach" please?. The goal is to list items of a specific container, like, I have datastores in folders, and I need to list folder names with the mean of each datastore, each in a separate line, for example:
Folder Datastore Name
#### ##############
folder1 datastore1
folder1 datastore2
folder2 datastore3
etc.,
Thank you,
If I understand the question correctly, you don't even need any form of 'foreach'.
A simple pipeline construct will work.
Something like this for example
Select ParentFolder,Name
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
If I understand the question correctly, you don't even need any form of 'foreach'.
A simple pipeline construct will work.
Something like this for example
Select ParentFolder,Name
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That did the trick, but I wanted also to seize the opportunity to learn about "foreach" with PowerCLi.
Thanks,
If you want a foreach, you could do like this
Get-Datastore -Location $_ |
Select ParentFolder,Name
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference