PowerShell for Windows Admins

Aug 11 2013   3:33PM GMT

Time Spans

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

I’ve been using Search-ADaccount a lot recently. One of the options is to input a timespan to determine for far back in time to search e.g. for accounts that have been inactive for 90 days

The cmdlet takes a string that can be turned into a timespan. if you look at the documentation the data type is a Timespan.

To search for accounts that have been inactive for 90 days

Search-ADaccount –AccountInactive –TimeSpan “90:00:00:00”

Alternatively, if you can’t remember the timespan structure

Search-ADaccount –AccountInactive –TimeSpan (New-TimeSpan -Days 90 )

 Comment on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: