Monday, February 25, 2013

wish (i knew when) you were here

User accounts in Active Directory store information about the last time a user was logged in. How can we use PowerShell to get the number of days since a user last logged on to the domain? A simple way to do this is to use DateTime objects. These guys have some nifty methods that deal very effectively with operations on—well—dates and times.
So what we’re going to do is get a user object’s last logon as a DateTime. The property we’re looking for is
the LastLogonDate property. We’ll also get the current time, and use the DateTime object’s Subtract method to determine the difference between then and now.
$DavesLastLogon = Get-ADUser Dave -Property LastLogonDate | 
        Select-Object -ExpandProperty LastLogonDate
$Now = Get-Date
$DaysSinceLastLogon =  $Now.Subtract($DavesLastLogon).Days
The resulting TimeSpan object has a Days property that we can examine and, voilĂ , that’s how many days have gone by since the user last logged on.
Use the object’s ToString method to get the days, hours, minutes and seconds in a format suitable for reports:
$Now.Subtract($DavesLastLogon).ToString()
Be seeing you.
​

Tuesday, December 27, 2011

love my chromebook, but...

it was 2002 when i installed thinkfree office as a cross-platform alternative to a popular proprietary office suite. that is when i began moving my life to the cloud. i realized that having to manage data on several computers running different operating systems was silly. i needed access to much of the same stuff on my mac, sparcstation, linux and windows pcs, and i didn't want to have to maintain multiple copies. the cloud made sense to me, though it wasn't then quite the buzzword that it has since become.

back then i predicted that we would one day run most of our software over the internet on a subscription basis. while we haven't arrived there yet, we're certainly going that way. i can now edit documents, touch up photos, record music and video, take notes, send email and text messages, make phone calls, listen to music, read books, watch movies and television shows, and write code all online. since that pretty well sums up most everything i do on a computer today i decided to take the plunge and pick up a chromebook, the samsung series 5 with 3g (in a lovely arctic white.) i have to say, i'm loving it, and i will keep you posted here about my adventures in google's vision of the cloud.

before i wrap up this post, i'll share my impressions after my first week with chromebook. i have to say, there are so many things i love about this device that i can't list them all. speed and convenience are at the top, though. but i have two needs that the chromebook doesn't address. one, i must have a local rdp client. i need to communicate with my company's terminal server from the public internet, but i also need to talk to virtualbox machines that are running on private networks. web-based rdp-to-html5 services can't access my private ip addresses, so a local client is a must. word is, google is working on this, so i'll wait. the second is java. now, if the chromebook had a jre then my first concern might disappear—i've found a very fine java rdp client. but there are many web sites that use java, not the least of which are those that host games like minecraft and runescape. after all, all work and no play...