Automation

 View Only
  • 1.  Limit Output of createdTime

    Posted Oct 15, 2019 12:28 PM

    $report = $vms.values | select-object Name, Powerstate, NumCpu, MemoryGB, Notes,

    @{N="Cluster";E={$_.vmhost.parent}},

    @{N="Last PowerOff";E={Get-VIEvent -Entity $_ -MaxSamples ([int]::MaxValue) | where {$_ -is [VMware.Vim.VmPoweredOffEvent]} | select createdTime}},

    @{ n="Space on Datastore"; e={[math]::round( $_.ProvisionedSpaceGB, 2 )}} | convertto-html -Head $strHtmlHead

    the Poweroff command bring out to much

    it looks like this

    @{CreatedTime=10/14/2019 10:47:14 AM}

    How can I limit it to the Date only?

    like-> 10/14/2019 10:47:14 AM

    ps the imput $vmsvalues is a arry of VM´s



  • 2.  RE: Limit Output of createdTime
    Best Answer

    Posted Oct 15, 2019 12:39 PM

    Use the ExpandProperty parameter

    @{N="Last PowerOff";E={Get-VIEvent -Entity $_ -MaxSamples ([int]::MaxValue) | where {$_ -is [VMware.Vim.VmPoweredOffEvent]} | select -ExpandProperty createdTime}},



  • 3.  RE: Limit Output of createdTime

    Posted Oct 15, 2019 12:59 PM

    oh wow,

    you are a real scripting Boss!

    Thanks