Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

powershell - modify accountexpires property

Posted on 2011-03-03
2
Medium Priority
?
1,490 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

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.
Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

916 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