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
$cimString
# Convert it to DateTime object:
$dateTime = [Management.ManagementDateTimeConverter]::ToDateTime($cimString)
$dateTime
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:
[Management.ManagementDateTimeConverter]::ToDateTime($cimString)
Hope you can undesrtand my question