Hi,
i need help to export the list of vms with diferents elements like harddisk, guestos, tag,... and i wan't to add a new colon with the created date of the vm, here is th script that i use, it work fine for all except the created date of the vm,
Get-Module -Name VMware* -ListAvailable | Import-Module
Connect-viserver myvcenter -user administrator -pass password123
$report = foreach($esx in Get-VMHost){
Get-VM -Location $esx |
Select @{N='VMHost';E={$esx.Name}},Name,PowerState,PortGroupName,
@{n="HardDiskSizeGB"; E={(Get-HardDisk -VM $_ | Measure-Object -Sum CapacityGB).Sum}},
@{N='GuestOS';E={$_.Guest.OSFullName}},
@{N='VeeamBackupJob';E={(Get-TagAssignment -Entity $_ -Category (Get-TagCategory -Name 'VeeamBackupJob')).Tag.Name -join '|'}},
@{N='Criticite';E={(Get-TagAssignment -Entity $_ -Category (Get-TagCategory -Name 'Criticite')).Tag.Name -join '|'}},
@{N='CreatedTime';E={$_.CreatedTime.ToString("ddMMyyyy")}},
@{N='Notes';E={$_.Notes.Replace("`n",'/')}}
}
$report | Export-Csv -Path C:\result\extract.csv -NoTypeInformation -UseCulture
thank you for your response