LucD,
I was hoping you would reply. Thank you!
I did try those scripts as well as the one located on your site here:
http://www.lucd.info/2010/10/21/get-the-folderpath/
The output became questionable on my end. The one from you site got very very close but the formating was completely different from what everyone else had as a result. What I got was:
Name: <name>
Path: <Path>
Type: <type>
Name: <name>
Path: <Path>
Type: <type>
Name: <name>
Path: <Path>
Type: <type>
Etc etc etc
Instead of a nice table, I got single lines. It was odd. This is the code I ran, I kept it 99.9999% (I added one line ) from your code.:
param(
[parameter(valuefrompipeline = $true,
position = 0,
HelpMessage = "Enter a folder")]
[VMware.VimAutomation.ViCore.Impl.V1.Inventory.FolderImpl[]]$Folder,
[switch]$ShowHidden = $false
)
begin{
$excludedNames = "Datacenters","vm","host"
}
process{
$Folder | %{
$fld = $_.Extensiondata
$fldType = "yellow"
if($fld.ChildType -contains "VirtualMachine"){
$fldType = "blue"
}
$path = $fld.Name
while($fld.Parent){
$fld = Get-View $fld.Parent
if((!$ShowHidden -and $excludedNames -notcontains $fld.Name) -or $ShowHidden){
$path = $fld.Name + "\" + $path
}
}
$row = "" | Select Name,Path,Type
$row.Name = $_.Name
$row.Path = $path
$row.Type = $fldType
$row
}
}
}
$vcserver = "name of my vcenter"
Connect-VIServer $vcserver
Get-Folder | Get-FolderPath
Thanks,
BostonTechGuy