Solved

powershell - modify accountexpires property

Posted on 2011-03-03
2
1,469 Views
Last Modified: 2012-05-11
Hello,

I always get account expires one day higher in the output than it is in AD.

Please would you advice how to lower this value by one day? I tried it with adddays(-1), maybe somehow to convert it into shortdatestring, But I am not sure how to provide it.

Many thanks


Get-QADUser -xxx -LdapFilter "((!sAMAccountName=xx*)(!sAMAccountName=xx*))" -IncludeAllProperties | select displayname,samaccountname,description `
,({$_.accountexpires}).adddays(-1)

But this doesnt work
0
Comment
Question by:Radim88
  • 2
2 Comments
 

Accepted Solution

by:
Radim88 earned 0 total points
ID: 35025908
Thx I did it in this way:

{ (get-date($_.accountexpires)).adddays(-1)}
0
 

Author Closing Comment

by:Radim88
ID: 35025909
thx
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

"Migrate" an SMTP relay receive connector to a new server using info from an old server.
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now