Timespan Filtering in Get-AdUser or Search-AdAccount

Welcome Forums General PowerShell Q&A Timespan Filtering in Get-AdUser or Search-AdAccount

This topic contains 1 reply, has 2 voices, and was last updated by

1 year, 9 months ago.

  • Author
  • #70813

    Points: 0
    Rank: Member

    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

    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

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

The topic ‘Timespan Filtering in Get-AdUser or Search-AdAccount’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort