Hello everyone, can you help me with this question? I need to compare two strings with time. I have a log file that contents information looks like that: 22.03.2021 18:59:16.111 | some information.... I need to get frome there only information about time and compare it with time is now. So I have a script:
$MD = get-date - format "HH:MM:s"
$path = some path to log file
$a = get-content -path $path -tail 1
$b = $a.SubString(11,8)
Then i need to use if statements as I think:
If (($MD).AddHours(-0,5) -gt $b) {do something}
else {do anotherthing}
But it will not works because $mb and $b is a string data :( how I can compare it?