Automation

 View Only
  • 1.  vmdk last written date

    Posted Aug 07, 2020 11:38 AM

    Hi Team,

    I am using below command and i able to view vmdk file.

    Get-VM -Name "Test VM" | Get-HardDisk -Name "Hard disk 1" | Select Filename

    But i want to view the last written date for the vmdk file.

    How may i achieve this.



  • 2.  RE: vmdk last written date
    Best Answer

    Posted Aug 07, 2020 11:52 AM

    You could do something like this

    $vmName = 'MyVM'

    $vm = Get-VM -Name $vmName

    Get-HardDisk -VM $vm -PipelineVariable hd | ForEach-Object -Process {

        $dsName,$path = $hd.Filename.Split(' ')

        $dsName

        $path

        $ds = Get-Datastore -Name $dsName.Trim('[]')

        New-PSDrive -Location $ds -Name DS -PSProvider VimDatastore -Root '\' | Out-Null

        Get-ChildItem -Path "DS:$path" | select -Property DatastoreFullPath,LastWriteTime

        Remove-PSDrive -Name DS -Confirm:$false

    }



  • 3.  RE: vmdk last written date

    Posted Aug 10, 2020 12:22 PM

    Hi LucD

    Can i have your email contact



  • 4.  RE: vmdk last written date

    Posted Aug 10, 2020 01:14 PM

    There is a Contact Form on my blog you can use.