PowerCLI

 View Only

Getting and VMDISK and Snapshot info

  • 1.  Getting and VMDISK and Snapshot info

    Posted Sep 18, 2018 09:11 AM

    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