|
 |
|
 |
 |
|
 |
 |
 |
 |
|
 |
 |
|
|
convert lastlogon value..
Last Post 15 Jul 2010 02:37 AM by Shay Levy. 3 Replies.
|
Sort:
|
|
Prev Next |
You are not authorized to post a reply. |
|
| Author |
Messages |
 |
destn
 New Member Posts:15

 |
| 15 Jul 2010 02:09 AM |
|
I have following commandline:
Get-ADUser -filter * -SearchScope Subtree -SearchBase "ou=sub,ou=sub,ou=sub,DC=domain,DC=com" | Get-ADObject -Properties lastlogon | Select-Object Name,lastlogon
I do get the lastlogon timestamp, but in unreadable format.
The conversion should be something like: [DateTime]::FromFileTime($lastlogon)
But how do I implement this on my commandline? |
|
|
|
|
Shay Levy PowerShell MVP, Admin
 Veteran Member Posts:1362

 |
| 15 Jul 2010 02:21 AM |
|
Get-ADUser -filter * -Properties lastlogon -SearchScope Subtree -SearchBase "ou=sub,ou=sub,ou=sub,DC=domain,DC=com" | select Name,@{n='lastlogon';e={[DateTime]::FromFileTime($_.lastlogon)}}
|
|
Shay Levy Windows PowerShell MVP
http://PowerShay.com
PowerShell Community Toolbar
Twitter: @ShayLevy |
|
|
destn
 New Member Posts:15

 |
| 15 Jul 2010 02:28 AM |
|
Great!
For future use, could you, in brief, explain following line:
@{n='lastlogon';e={[DateTime]::FromFileTime($_.lastlogon)}}
@{} => I guess this is a scriptblock that needs execution first?
but the:
n='lastlogon';e={}
is hard to understand. |
|
|
|
|
Shay Levy PowerShell MVP, Admin
 Veteran Member Posts:1362

 |
|
| You are not authorized to post a reply. |
|
Active Forums 4.3
|
|
 |
 |
|
 |
 |
Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2
|
 |
|
|