Timespan Filtering in Get-AdUser or Search-AdAccount

This topic contains 1 reply, has 2 voices, and was last updated by  Don Jones 1 year ago.

  • Author
  • #70813


    These commands are pretty straight forward and basic.

    get-aduser -filter * -properties passwordlastset, passwordneverexpires | sort name | ft Name, passwordlastset, Passwordneverexpires

    Search-AdAccount -PasswordExpired

    I am not a programmer however I would like to some how evoke the PasswordLastSet Command or Filter the -PasswordExpired to command to users only who's account has expired in the past 7 days or will be expiring in the future 7 days. Is there a way to pipe the Search-AdAccount Command let into a timespan filter? I am not aware that timespan is usable in any two of these Commandlets.

    Thank you in Advance.

  • #70855

    Don Jones

    You have to calculate the actual date of 7 days ago or whatever, and pass it in as a static filter.

You must be logged in to reply to this topic.