Hi All,
We have created hirarchical folders in inventory , as per the application and location. i would like to export the VM list with the folder name which they are in ( multiple folders if there). Could you please let me if any one know the procedure or any tool for the same.
We have hundreds of folders in the inventory , it geting very difficult for me to get the list folderwise.
Thank You ...
RR
Hi RR
I am sure RVTools can give you this and more - http://www.robware.net/
You can export all the information into csv or excel formats. I hope this helps.
You could do this with PowerCLI using the New-VIProperty cmdlet. The below sample, curtesy of LucD, creates the new property FullFolderPath. The properties for a VM object contains a foldername, but it isn't the full folder path so you wouldn't be able to distinguish between duplicate folders. So if you were to run get-vm | ft name, folder it wouldn't be too helpful.
New-VIProperty -Name 'FullFolderPath' -ObjectType 'VirtualMachine' -Value {
param($vm)
function Get-ParentName{
param($object)
if($object.Folder){
$blue = Get-ParentName $object.Folder
$name = $object.Folder.Name
}
elseif($object.Parent -and $object.Parent.GetType().Name -like "Folder*"){
$blue = Get-ParentName $object.Parent
$name = $object.Parent.Name
}
elseif($object.ParentFolder){
$blue = Get-ParentName $object.ParentFolder
$name = $object.ParentFolder.Name
}
if("vm","Datacenters" -notcontains $name){
$blue + "/" + $name
}
else{
$blue
}
}
(Get-ParentName $vm).Remove(0,1)
} -Force | Out-Null
So you would first run the above code in your PowerCLI session. What you create with New-VIProperty only exists for that PowerCLI session. Once you close it, the new property is gone.
The you can run get-vm | ft name, fullfolderpath
Name FullFolderPath
---- --------------
MAIL01
WINDOWS07
EXCHANGE01
SERVER01 /Production
DC09 /Production
VCENTER_01 /Production
QUICKTAX /Taxes
vMA5.0
QUICKTAX_BACKUP_PRE2012_TAXES /Taxes/Backup
One thing to note about the output. In the case of the first few VMs, those are not in a VM folder. For the vMA5.0 VM, it is a vApp.
Thanks Dave ... I am not that good in CLI , i will try with this.
Thank You..... Alim.
It didnt give the result what i was looking for , but great tool which i was not aware. Thank You for that
I'm glad it was helpful.