Coming soon - Get a detailed view of why an account is flagged as spam!
view details

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.

4
Adding a variable to working CLI line?
Post Body

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?

Author
Account Strength
100%
Account Age
9 years
Verified Email
Yes
Verified Flair
No
Total Karma
1,243
Link Karma
740
Comment Karma
503
Profile updated: 4 days ago
Posts updated: 4 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
7 years ago