# I think you down understand my question ...
#
# I need more arguments in variable "-incl_Service" and "-excl_Service"
# ========= =============== ==============
#
# .\service-query.ps1 localhost -startmode * -state running -incl_Service D*, Fax, *Update* -excl_Service Design*, DHCP*"
# ==============================================
#
# This query is ok, but i missing more than on incl_Servic e.g: DNS*, DHCP, *Update*, ... , ... , ... on both variables
#
param(
[string] $Computername,
[string] $StartMode,
[string] $State,
[string[]]$incl_Service,
[string[]]$excl_Service
)
echo"Command : .\service-query.ps1 localhost -startmode * -state running -incl_Service D*"
echo"-----------"
echo"Computername :$Computername"
echo"StartMode :$StartMode"
echo"State :$State"
echo"include Service :$incl_Service"
echo"exclude Service :$excl_Service"
$i= 0
foreach ($Servicein$incl_Service)
{
$Service=get-wmiobjectwin32_service-Computer $Computername|`
Select-ObjectDisplayName,State|`
where { ($_.DisplayName-replace$excl_Service-like$incl_Service )-and ($_.StartMode-like$StartMode)-and ($_.State-like$State)}`
}
$Service; $i++