Created
April 30, 2018 22:12
-
-
Save tonejito/4a907e14c0f44029dfdebebe229de207 to your computer and use it in GitHub Desktop.
Display status of VMware vCenter Server services and dependencies
This file contains hidden or 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
#!%SystemRoot%\System32\WindowsPowerShell\v1.0\PowerShell.exe | |
# | |
# Check-VMware-vCenter-Services | |
# Display status of VMware vCenter Server services and dependencies | |
# Andres Hernandez - April 2018 | |
# | |
# https://docs.microsoft.com/en-us/powershell/scripting/powershell-scripting?view=powershell-3.0 | |
# http://adamringenberg.com/powershell2/ | |
# https://allunifiedcom.files.wordpress.com/2010/07/powershell_v2_owners_manual.pdf | |
# Hack to maximize the current console window | |
PowerShell -WindowStyle Maximized "Clear-Host" | |
# Get service status for SQL Server, VMware* and vCenter services | |
Write-Host "Service status:" | |
Get-Service | | |
Where-Object { $_.DisplayName -like "*SQL*" -or $_.DisplayName -like "*VMware*" -or $_.DisplayName -like "*vCenter*" } | | |
Sort-Object -Property @{Expression="Status";Descending=$true}, @{Expression="DisplayName";Descending=$false} | | |
Format-Table -AutoSize -GroupBy "Status" | |
# Print the detail of the required services | |
Write-Host "Service detail:" | |
$a = @() | |
foreach ( $service in @( "MSSQLSERVER" , "vpxd" , "vctomcat" , "vimQueryService" , "vimPBSM" ) ) | |
{ | |
$a += Get-Service $service | Select-Object Status,ServiceName,DisplayName,RequiredServices,DependentServices | |
} | |
Sort-Object -InputObject $a -Property "Status" | Format-List | |
# Press any key to exit | |
Read-Host |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example output: