Calculated Property CIM Time Format RRS feed

  • Question

  • Hi Team!

    So, I write a single line log with some computer values, separated by ","

    Then read it and asign those as a  property value:

    # Get last bootup time in CIM format: 
    $cimString = (Get-WmiObject Win32_OperatingSystem).LastBootUpTime
    # Convert it to DateTime object:
    $dateTime = [Management.ManagementDateTimeConverter]::ToDateTime($cimString)

    Each variable is passed separated by ";"...   $cimString;$dateTime (remove the first line of log wich is ussed only as a log header

    $cimString is a date in CIM format and has assigned the LastBootUpTime property value

    dir "c:\temp\*.txt"  | ForEach {Get-Content $_ | Select-Object -Skip 1 | ConvertFrom-String -Delimiter ";" -PropertyNames Username, Computername, UpTimeDays, LastBootUpTime

    The question is... How to make the calculated property for LastBootUpTime to show this content of:


    Hope you can undesrtand my question

    • Edited by Victor M$ Friday, February 9, 2018 12:33 PM
    Friday, February 9, 2018 12:23 PM

All replies

  • help import-csv -online

    follow the instructions.


    Friday, February 9, 2018 12:44 PM