vSphere Object by Path

In an older post, named Folder by Path, I provided a function to retrieve a Folder object by it’s path.

With the recent publication of my Get-InventoryPlus function, I can now get the path to all vSphere objects. So the obvious next step was to create a function, that would be able to use that information and retrieve any vSphere object by it’s path.

IMG_20160602_084338

The function was first demonstrated during the 24th VMUGBe in Mechelen.

Continue reading vSphere Object by Path

Folder by Path

There seem to be many vSphere environments where the same foldername is used multiple times. A blue folder with the name Servers is quite common for example.

If you need to retrieve such a folder with the Get-Folder cmdlet, you will have to walk the path to the folder leaf by leaf and use the Location parameter. It would be handier if you could just specify the path to the folder and retrieve the folder like that.

The following is a small function that will allow you to do just that.

Update August 6th 2020: The missing NoRecursion switch caused folders by the same name, further down in the hierarchy, to be returned as well.

Update July 5th 2019: The functions have been updated to support the situation where a user is connected to multiple vSphere Servers.

Update February 18th 2016: In some situations the function might return folders with the same name from different location. Fixed by adding NoRecursion on line 48
Continue reading Folder by Path