Thank you for taking a look.

I have a script that grabs disabled AD users and sorts them by last logon date. The output is an HTML table. That works fine. I have an additional script i found that will color a cell or row based on a filter and it works as long as I am not using dates. Looking into it more that script is okay but PS is doing something odd. Please look at the code below. I’d like to know why dates with the months January and October create a false condition.

Thank you for your help,

Paul

PS X:\> (Get-Date).AddDays(-30) Sunday, October 18, 2020 3:48:09 PM PS X:\> "The condition is " + (&{If("2/2/2019 2:11:09 PM" -gt (Get-Date).AddDays(-30)) {"True"} Else {"False"}}) + "." The condition is True. PS X:\> "The condition is " + (&{If("1/2/2019 2:11:09 PM" -gt (Get-Date).AddDays(-30)) {"True"} Else {"False"}}) + "." The condition is False. PS X:\> "The condition is " + (&{If("1/31/2019 2:11:09 PM" -gt (Get-Date).AddDays(-30)) {"True"} Else {"False"}}) + "." The condition is False. PS X:\> "The condition is " + (&{If("11/31/2019 2:11:09 PM" -gt (Get-Date).AddDays(-30)) {"True"} Else {"False"}}) + "." The condition is True. PS X:\> "The condition is " + (&{If("1/31/2019 2:11:09 PM" -gt (Get-Date).AddDays(-30)) {"True"} Else {"False"}}) + "." The condition is False. PS X:\> "The condition is " + (&{If("1/31/2019" -gt (Get-Date).AddDays(-30)) {"True"} Else {"False"}}) + "." The condition is False. PS X:\> "The condition is " + (&{If("1/31/2019 2:11:09 PM" -gt (Get-Date).AddDays(-30)) {"True"} Else {"False"}}) + "." The condition is False. PS X:\> "The condition is " + (&{If("1/1/2019 2:11:09 PM" -gt (Get-Date).AddDays(-30)) {"True"} Else {"False"}}) + "." The condition is False. PS X:\> "The condition is " + (&{If("2/1/2019 2:11:09 PM" -gt (Get-Date).AddDays(-30)) {"True"} Else {"False"}}) + "." The condition is True. PS X:\> "The condition is " + (&{If("3/1/2019 2:11:09 PM" -gt (Get-Date).AddDays(-30)) {"True"} Else {"False"}}) + "." The condition is True. PS X:\> "The condition is " + (&{If("4/1/2019 2:11:09 PM" -gt (Get-Date).AddDays(-30)) {"True"} Else {"False"}}) + "." The condition is True. PS X:\> "The condition is " + (&{If("5/1/2019 2:11:09 PM" -gt (Get-Date).AddDays(-30)) {"True"} Else {"False"}}) + "." The condition is True. PS X:\> "The condition is " + (&{If("6/1/2019 2:11:09 PM" -gt (Get-Date).AddDays(-30)) {"True"} Else {"False"}}) + "." The condition is True. PS X:\> "The condition is " + (&{If("7/1/2019 2:11:09 PM" -gt (Get-Date).AddDays(-30)) {"True"} Else {"False"}}) + "." The condition is True. PS X:\> "The condition is " + (&{If("8/1/2019 2:11:09 PM" -gt (Get-Date).AddDays(-30)) {"True"} Else {"False"}}) + "." The condition is True. PS X:\> "The condition is " + (&{If("9/1/2019 2:11:09 PM" -gt (Get-Date).AddDays(-30)) {"True"} Else {"False"}}) + "." The condition is True. PS X:\> "The condition is " + (&{If("10/1/2019 2:11:09 PM" -gt (Get-Date).AddDays(-30)) {"True"} Else {"False"}}) + "." The condition is False. PS X:\> "The condition is " + (&{If("11/1/2019 2:11:09 PM" -gt (Get-Date).AddDays(-30)) {"True"} Else {"False"}}) + "." The condition is True. PS X:\> "The condition is " + (&{If("12/1/2019 2:11:09 PM" -gt (Get-Date).AddDays(-30)) {"True"} Else {"False"}}) + "." The condition is True. PS X:\>