Archive for October 30th, 2007

Date/Time User Properties

One of the enhancements of the 1.0.5 release is more attributes being exposed in their native formats. For example, AD cmdlets automatically convert the properties which should be date/time to the DateTime time so you don’t have to worry about the conversions and can just work with them.

Let’s see which Date/Time attributes my account has:

Get-QADUser "Dmitry Sotnikov" -IncludeAllProperties | Get-Member -MemberType NoteProperty | where {$_.Definition -like "*DateTime*" } | Format-List Name, Definition


Name : accountExpires
Definition : System.DateTime accountExpires=12/31/9999 11:59:59 PM

Name : badPasswordTime
Definition : System.DateTime badPasswordTime=10/29/2007 1:22:06 PM

Name : createTimeStamp
Definition : System.DateTime createTimeStamp=6/16/2004 3:59:22 PM

Name : lastLogoff
Definition : System.DateTime lastLogoff=1/1/1601 12:00:00 AM

Name : lastLogon
Definition : System.DateTime lastLogon=10/30/2007 12:04:22 PM

Name : lockoutTime
Definition : System.DateTime lockoutTime=1/1/1601 12:00:00 AM

Name : modifyTimeStamp
Definition : System.DateTime modifyTimeStamp=10/29/2007 12:20:24 AM

Name : pwdLastSet
Definition : System.DateTime pwdLastSet=8/27/2007 4:09:54 PM

Name : whenChanged
Definition : System.DateTime whenChanged=10/29/2007 12:20:24 AM

Name : whenCreated
Definition : System.DateTime whenCreated=6/16/2004 3:59:22 PM

Let’s see what I was doing in the command above:

  1. I retrieved my user object using Get-QADUser and supplying the name.
  2. Used -IncludeAllProperties to make the cmdlet retrieve all AD attributes and not just the default set (which would not have: createTimeStamp and modifyTimeStamp).
  3. Used Get-Member and Where to only leave Property members of the DateTime type.
  4. Formatted the output as a list with the names and definitions (type and value).

Note that you can operate DateTime values for filtering too.

For example, to see a list of accounts which never logged on this year you would do:

$threshold = (Get-Date).AddYears(-1)
Get-QADUser -IncludedProperties lastLogonTimestamp | where { $_.lastLogonTimestamp -le $threshold }

Pretty straight-forward, right? ;)

Note:

  • To have lastLogonTimestamp replicated between DCs the domain should be in Windows 2003 mode.
  • If your domain is still in Windows 2000 mode, you have to query for lastLogon from each DC (for every user), as lastLogon is a non-replicated attribute.
  • lastLogonTimestamp is updated each 14 days by default (in reality it is more often): http://msdn2.microsoft.com/en-us/library/ms676824.aspx.

Tags: , , , , , ,


My Recent Tweets

RSS My company’s blog

  • Secure Access to Your Jetty Web Application
    Today’s post focuses on the web application security related features of Jetty app server. After reading this article you should be able to configure security realms to provide authentication and access control for your Jetty web application, as well as to grant access to your app for dedicated IP-addresses only. Before we start let’s examine what Jetty real […]
  • Software Stacks Market Share: May 2013
    We are back to update you with the latest trends in software stacks popularity for May 2013. This time we decided to collect the numbers in a different way to get more accurate statistics. As you remember previously we counted the number of the environments, where each software stack was used. We’ve changed the reporting [...]The post Software Stacks Market […]
  • Setting Up a Cronjob in Jelastic Cloud
    Cronjob allows you to configure regularly scheduled tasks so that the jobs can be run automatically at a pre-set point of time. It repeats itself and does not need any regular manual instructions. Cron automates your system and can be used for quite different purposes. This wonderful tool is a standard part of all sysadmins toolkit. Also cronjob has a [...]T […]
  • How to Deploy Joget Cluster into the Cloud
    Joget Workflow is an open source platform that allows you to build enterprise web applications easily, due to its rich set of tools. It is also a rapid application development platform that provides complete agile development capabilities, including consisting of processes, forms, lists, CRUD and UI; not just back-end EAI/orchestration/integration or the tas […]
  • Liferay Cluster in the Cloud
    Liferay Portal is one of the most popular Java CMSs in the world due to its impressive ease-of-use. Since we published the tutorial on Liferay deployment to the cloud we have seen an extremely positive reaction from its community. Also we have received multiple requests from Liferay fans asking about clustering, replication and fail-over capabilities in the […]
  • Mark Zbikowski Veteran Microsoft Architect Joins Jelastic
    Jelastic already has an impressive team of advisers including Serguei Beloussov, the founder of Parallels. We also have technical geniuses who endorse and use Jelastic including the father of Java James Gosling, David Blevins who founded the TomEE project, and Michael “Monty” Widenius, the author of the original version of the open-source MySQL database and […]
  • Jelastic at HostingCon 2013
    Get out your ten-gallon hats; we’re heading to Texas! We’re happy to announce that Jelastic will be participating at HostingCon 2013 in beautiful Austin, TX. Please see the contact details below for booking a meeting. We are very much looking forward to seeing some familiar faces, as well as meeting new industry gurus. See y’all [...]The post Jelastic at Hos […]

Legal

The posts on this blog are provided “as is” with no warranties and confer no rights. The opinions expressed on this site are mine and mine alone, and do not necessarily represent those of my former employer - Quest Software, or my current employer - Jelastic or anyone else for that matter. All trademarks acknowledged.

© 2007-2013 Dmitry Sotnikov

Pages

October 2007
M T W T F S S
« Sep   Nov »
1234567
891011121314
15161718192021
22232425262728
293031  

Follow

Get every new post delivered to your Inbox.

Join 67 other followers

%d bloggers like this: