######################################################################### # # Author: Christian Birkenbeul # Version: 1.0 # # Change Log # 1.0 # Creating Plugin # ########################################################################## <# .Synopsis Checking Hyper-V Integration Services .Description Checking Hyper-V Integration Services and lists failed vms and his current version. .Parameter current Current Integration Services Version given via nsclient++ #> $current = $ARGS[0] $okvms = @() $failedvmname = @() $vm = Get-VM |Select-Object Name,IntegrationServicesVersion foreach ($line in $vm) { if ($current -eq $line.IntegrationServicesVersion) { $okvms += $line.Name } else { $failedvmname += $line.Name $failedvmvers += $line.IntegrationServicesVersion } } if($failedvmname.Length -gt 0) { Write-Host $failedvmname.Length "Integration Services are old or not installed." Write-Host $failedvmname - $failedvmvers exit 1 } else { Write-Host "All $($okvms.Length) VMs has current Version." exit 0 }