Am trying to get the Snapshot and Harddisk info from the below script. It works without issues until the harddisk format, however snapshot details are giving output with Type information like systemobject[]. Am i missing something here ?
Get-Datastore -Name Datastore1 -PipelineVariable Datastore |
Get-VM -PipelineVariable VM |
Get-HardDisk -PipelineVariable HardDisk |
[pscustomobject]@{
Datastore=$Datastore.Name
VM_Names=$VM.Name
FileName=$HardDisk.FileName
StorageFormat=$HardDisk.StorageFormat
Snapshot_Name = $VM|get-snapshot |select name
Snapshot_Date = $VM|get-snapshot |select Created
}
} | Export-csv c:\output.csv -Append -NoTypeInformation