This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
I've got a request in to get a list of machines with their last logon time and last reboot. So far, I've written this:
Get-ADComputer -Filter "Name -like 'PCName-*'" -Properties * | select-object Name, DistinguishedName, LastLogonDate, Description
That works and returns back what was originally requested. However, as some users don't reboot ever, the timestamps for logons may be wrong. To get more accurate info to the requestors, adding a variable of the last boot time could be useful.
I created a variable here: $booted = (Get-WMIObject Win32-OperatingSystem).LastBootUpTime
Where can the variable "$booted" inserted into the above command line string?
Subreddit
Post Details
- Posted
- 7 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/PowerShell/...