Skip to content

Commit

Permalink
new script
Browse files Browse the repository at this point in the history
  • Loading branch information
adbertram committed Dec 12, 2015
1 parent 2bc60f3 commit f531257
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Hyper-V/Get-HyperVUptime.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
$hyperVHost = 'HYPERVSRV'
$vmUptimes = Get-VM -ComputerName $hyperVHost | select name, uptime, @{ n = 'Type'; e= { 'VM' } }

$wmiParams = @{
'ComputerName' = $hyperVHost
'Class' = 'Win32_OperatingSystem'
}
$hostUptime = Get-WmiObject @wmiParams | select @{ n = 'Uptime'; e = { (Get-Date) - ($_.ConvertToDateTime($_.LastBootUpTime)) } },
@{ n = 'Name'; e = { $_.PSComputerName } },
@{ n = 'Type'; e = { 'Host' } }

($vmUptimes + $hostUptime)

0 comments on commit f531257

Please sign in to comment.