Update Version with backward compatibility

You can run the script with no arguments and it will return all the services
powershell .\service_lld_WMI.ps1

You can run the script with arguments and it will return only a family of services
This script is getting 2 arguments as input -regex "The regular expression that will search each like to match" -sun "The Service Unique Name"
powershell .\service_lld_WMI.ps1 -regex "Appication\w+" -sun "_App"

In Zabbix agent you must put the following lines in the config

UnsafeUserParameters=1
UserParameter=service2.lld[*],powershell "[PATH TO SCRIPT]\service_lld_WMI.ps1" -regex "'$1'" -sun "$2"
UserParameter=service.lld[*],powershell "[PATH TO SCRIPT]\service_lld_WMI.ps1"

Without arguments you will have the old MACRO format {#SERVICESTATE}
With arguments you will have the following MACRO format {#SERVICESTATE[$-sun passed argument]}