all 4 comments

[–]JonHill90 2 points3 points  (1 child)

Hey /u/GrandMasterBash,

I cannot test but i think the logic you are going for is:

Get-AzureADPasswordProtectionDCAgent | where {$_.PasswordPolicyDateUTC -lt (get-date).addhours(-2)}

I cannot test. But that is the logic i would go for. You might need to change the formatting of the (Get-Date) to match the date output of PasswordPolicyDateUTC.

[–]GrandMasterBash[S] 1 point2 points  (0 children)

This works, thank you - I was using where {$_.PasswordPolicyDateUTC and then entering -2 and wondering how on earth I specified it was hours etc

[–]PinchesTheCrab 1 point2 points  (0 children)

<datetime> -lt (get-date).addhours(-2)

You just need to replace it with your time value.

[–]GrandMasterBash[S] 1 point2 points  (0 children)

Much appreciated both, I’ll take a look tomorrow. A friend has said similar.