EUCweb / BIS-F

Base Image Script Framework (BIS-F)
https://eucweb.com
GNU General Public License v3.0
99 stars 34 forks source link

Detect different Hypervisortools and Version #13

Closed EUCweb closed 6 years ago

EUCweb commented 6 years ago

From @matthias-schimm on March 12, 2018 20:28

add a central function to get back the installed Hypervisortools and the version of it

Copied from original issue: EUCweb/BIS-F#15

EUCweb commented 6 years ago

XenServer: DisplayName: XenServer Agent ServiceName: xenagent

VMware: DisplayName: VMware Tools ServiceName: vmtools

Hyper-V DisplayName: Hyper-V Guest Service Interface ServiceName: vmicguestinterface

AHV: DisplayName: Nutanix Guest Tools Agent ServiceName: Nutanix Guest Agent

EUCweb commented 6 years ago

Function Get-Hypervisor { <# .SYNOPSIS Get the installed Hypervisor like XenServer, VMware, Hyper-V, Nutanix AHV

    use get-help <functionname> -full to see full help
.EXAMPLE
    Get-BISFHypervisor

.Inputs
.Outputs
.NOTES
    Author: Matthias Schlimm
    Company: EUCweb.com

    History
    Last Change: 26.03.2018 MS: Script created

.Link
  #

>

Xenserver

$svc = Test-BISFService -ServiceName "xenagent" -ProductName "XenServer Tools"
$HV="XenServer"

VMware

$svc = Test-BISFService -ServiceName "vmtools" -ProductName "VMware Tools"
$HV="VMware"

Hyper-V

$svc = Test-BISFService -ServiceName "vmicguestinterface" -ProductName "Hyper-V Guest Service Interface"
$HV="Hyper-V"

NUatnix AHV

$svc = Test-BISFService -ServiceName "Nutanix Guest Agent" -ProductName "Nutanix Guest Tools"
$HV="AHV"

IF ($svc) { return $HV } ELSE { Write-BISFLog -Msg "No supported Hypervisor Tools installed, maybe BIS-F is running on hardware" -ShowConsole -Type W $return $false }