Created
May 16, 2014 16:12
-
-
Save AspenForester/c07d27c265453cd59c9c to your computer and use it in GitHub Desktop.
Powershell to create a grid view of Server boot times. This is just a quick and dirty script (its really just a long one-liner), needs to be redeveloped into a more reusable tool.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# requires -version 3.0 | |
$filter = {((name -notlike "*d") -and (name -notlike "*q")) -and ((name -notlike "dev*") -and (name -notlike "vdev*"))} | |
$SB = "OU=Servers,OU=Computers,OU=MyLocale,OU=MyDataCenterr,OU=NA,DC=foo,DC=local" | |
Get-ADComputer -filter $filter -SearchBase $SB -SearchScope Subtree | | |
where {(Test-Connection -ComputerName $_.name -Count 1 -Quiet)} | | |
% { Get-WmiObject -Class win32_operatingsystem -computername $_.name -Verbose} | | |
select csname, @{LABEL='LastBootUpTime';EXPRESSION={$_.ConverttoDateTime($_.lastbootuptime)}} | | |
#Sort-Object -Property LastBootUpTime | |
Out-GridView -Title "Production Servers" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment