provider/hyperv/Test-IcingaHyperVInstalled.psm1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<#
.SYNOPSIS
    Tests if the vmms service is installed which indicates if the Hyper-V
    role is installed on the system without requiring administrative privileges
.DESCRIPTION
    Tests if the vmms service is installed which indicates if the Hyper-V
    role is installed on the system without requiring administrative privileges
.OUTPUTS
    System.Boolean
.LINK
    https://github.com/Icinga/icinga-powershell-hyperv
#>


function Test-IcingaHyperVInstalled()
{
    if (Get-Service -Name 'vmms' -ErrorAction SilentlyContinue) {
        return $TRUE;
    }

    if (Test-IcingaFunction 'Get-WindowsFeature') {
        if ((Get-WindowsFeature -Name Hyper-V).Installed) {
            return $TRUE;
        }
    }

    return $FALSE;
}