I need to list all my computers with last boot time. I found a good tip like this: "Get-ADCodownloadmputer -Filter * -Property * | Format-Table Name,OperatingSystem,OperatingSystemServicePack,OperatingSystemVersion -Wrap –Auto" , However I didnt find a way to get the latest boot time and set a specified OU. Is ther a way to do that, adding those options to the command?
Computer Management Power shell
- 446 Views
- Last Post 14 April 2019
For the query you specified, you can set the OU in your query like so:
get-adcomputer -searchbase "ou=computers,ou=region,dc=example,ou=org"
-filter * property operatingsystemservicepack,operatinsystemversion |
| export-csv -notype c:\temp\computers.csv
Since Active Directory doesn't keep track of boot times, you'll have
extra work to do.
One way will be to poll the event logs on all of the DCsto see about
logon times for the machines - but that's going to be a bit tricky,
since for for at least some computers (laptops offsite, etc.) it's
possible that the will not have contacted a DC at boot time.
The other way I can think of is to poll the machines in the domain
with WMI or CIM to find their boot or up time - but again, that
depends on the machines being up and available to your queries.