The registry contains a key, with a string value much like:
23-01-2015 14-58-00
Using PowerShell I need to compare this date to ensure it is gr
You'll want to use ParseExact:
[datetime]::ParseExact("23-01-2015 14-58-00","dd-MM-yyyy HH-mm-ss",$null)
Friday, January 23, 2015 2:58:00 PM
This outputs a DateTime object. "dd-MM-yyyy HH-mm-ss"
is a specific mapping to your required DateTime format, using DateTime format placeholders for year, month, day, etc. If I didn't assume the correct format placeholders, just click that link above to find the ones you intended.
Afterwards, you can compare the two DateTime objects as you expected:
$myDate = [datetime]::ParseExact("23-01-2015 14-58-00","dd-MM-yyyy HH-mm-ss",$null)
$myDate -gt (Get-Date).AddDays(-1)
True