Get the last modified date and time

Before we dive into this week’s teaser we would like to announce the winner of last week’s challenge. Ioan Corcodel, congratulations! You take with you a copy of Microsoft Windows PowerShell 3.0 First Look written by Adam Driscoll. Once again, we would like to thank our sponsor Packt, one of the most prolific and fast-growing tech book publishers in the world, for providing such a cool prize.

Ioan, your solution worked great and it was 78 characters long. By the way, I was able to shave off a few more characters 🙂 ,75 vs. 78 :

echo Hannah Jeffrey ‘12321’ Madam Abracadabra|?{-join$_[$_.Length..0]-eq$_}

As for this week’s teaser, your task is to get the last modified date and time of a file system object, without referring to the LastWriteTime property.

For this example, you need to emit the LastWriteTime value of powershell.exe as a System.DateTime object.

One thing though, there’s no prize this week. I know you guys are here for the challenge and the prize is only an excuse to participate and share your knowledge. 🙂

Again, comments are allowed until Friday and we will announce the winner on Monday, next week.

Please use the comment box at the bottom of this page to submit your solution. Don’t have a solution of your own, or it has been already posted by others? You can still participate and add your voice by voting on a existing comments, use the up/down voting arrows.

Share on: