Ninja Cowgirl
Ninja Cowgirl

Reputation: 11201

Comparing dates without time

I have the following code that compares two dates. Is it possible to ignore the time that comes with $ExpirationDate and $EndDate?

if(((get-date $ExpirationDate).Date -gt (get-date $EndDate).Date) -And $userAccountControl -eq "512")

Upvotes: 2

Views: 8982

Answers (1)

Ninja Cowgirl
Ninja Cowgirl

Reputation: 11201

I added elseif for AD account status 544 and that fixed the issue.

elseif(((get-date $ExpirationDate).Date -gt (get-date $EndDate).Date) -And $userAccountControl -eq "544")

Upvotes: 2

Related Questions