Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

powershell detect user/computer last modified date

$
0
0

I am noticing that the usnChanged, whenChanged, and modified properties on user and computer objects do not update when the object gets added to or removed from a group.  Is there a way to detect this?  

More info:
I have a shadowgroup script that processes every 3 hours on all users and computers under a given OU.  Currently it takes about 12 minutes to complete.  I could really speed this up and make it more efficient if I could skip users whose group membership have not changed in the last 3 hours.  Something like this:

Text
foreach user in ThisOU {
   if dateModified is greater than 3 hours {
      Continue
   }

   do a buncha stuff that takes for ever
} 

Viewing all articles
Browse latest Browse all 15370

Trending Articles