Powershell: SCVMM Host Status Snippet

December 1, 2011

I changed this around in my last script to verify the operational status of a host via SCVMM instead of the Hyper-V server itself.

function CheckHostStatus	{
$HostState = Get-VMHost $VMHost
		if (($HostState.ComputerState -match "Responding") -and ($HostState.ClusterNodeStatus -match "Running") -and ($HostState.VirtualServerState -match "Running") -and ($HostState.VirtualServerStateString -match "Running") -and ($HostState.CommunicationStateString -match "Responding") -and ($HostState.CommunicationState -match "Responding")) {
		Write-Host "Host is operational"
										}
		Else    {
		Write-Host "Host is not fully operational"
		sleep 120
		CheckHostStatus
				}
							}

posted in Hyper-V, Scripting, Virtualization by Jason Ruiz

Follow comments via the RSS Feed | Leave a comment | Trackback URL

Leave Your Comment

 
Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org