06 Mar 2013 @ 10:31 AM 

This one goes on the category of crazy-oneliners.
After I finished writing it I looked back and saw just how crazy huge it was…
Nevertheless, I still like to share:

Get-WmiObject -Class Win32_NetworkLoginProfile | 
Sort-Object -Property LastLogon -Descending | 
Select-Object -Property * -First 1 | 
Where-Object {$_.LastLogon -match "(\d{14})"} | 
Foreach-Object { New-Object PSObject -Property @{ Name=$_.Name;LastLogon=[datetime]::ParseExact($matches[0], "yyyyMMddHHmmss", $null)}}

Post to Twitter

Posted By: Jeff Wouters
Last Edit: 06 Mar 2013 @ 10:31 AM

EmailPermalink
Tags
Categories: DuPSUG, PowerShell, Windows



 Last 50 Posts
 Back
Change Theme...
  • Users » 1
  • Posts/Pages » 250
  • Comments » 429
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

About



    No Child Pages.

Contact



    No Child Pages.