Product: PowerShell Universal
Version: 2.12.4
Hi everyone,
I have a script I put together that I in turn created an API from in our PSU server. The script returns data from Active Directory concerning users whos passwords are going to expire within 7 days. I’ve noticed when running the script in say, the ISE, the data returned looks good. But when I run the Invok-RestMethod one of the keys in my hashtable that gets returned is coming out a bit funky:
I have an ExpiryDate property created by doing the following for each AD user:
@{Name=“ExpiryDate”;Expression={[datetime]::FromFileTime($_.“msDS-UserPasswordExpiryTimeComputed”)}}
When running the script in PowerShell or the ISE the property is returned as:
ExpiryDate : 9/5/2022 11:32:35 AM
When I invoke that same script as an API, I get:
ExpiryDate : @{value=2022-09-04T19:06:30.9027519-04:00; DateTime=Sunday, September 4, 2022 7:06:30 PM}
Is there a way I can call the DateTime= section of this key?