This article is part of the few-liner series, where you can find some useful powershell examples. Of course, you need to adjust the values/paths to your needs. Also, I know there may be other ways to achieve the same results but this is not a base for an “which-command-is-better” competition. Depending on the time you read this post, there may be new commandlets making things easier but I do not regulary update this blog series.
Convert LDAP/AD Timestamp to DateTime
$timestamp = 131001091660000000 (Get-Date 1/1/1601).AddDays($timestamp/864000000000)
Get distinguished name of computer object
([adsiSearcher]"(cn=$($env:Computername))").FindOne().Path
Get DNS name of computer
[System.Net.Dns]::GetHostEntry($env:Computername).HostName
Leave a Reply
You must be logged in to post a comment.