Code is almost done but seem to be missing something. The DisplayName is out-putting the the service name not the DisplayName of the service. So basically the Service is showing twice in the CSV file.
I’d recommend NOT to use wildcards in the service name to query. If there are more than one services fitting to the pattern you use you will not get the results you’re looking for. If you want to query more than one service at a time you have to extend your code to reflect this requirement.
I need the wildcard as the service that gets installs puts a unique number in the service name each time it installs. So when i am search 5000 computers that all have a different number at the end of the service name i need to use a wildcard. But i get your original point and would not otherwise use a wildcard if i didn’t have to.
Your code worked to give me the DisplayName but now i am missing the Services name. I need to have both the ServiceName and the DisplayName
Looks like i might have spoke too soon. While the script does work after i ran it fully the first time and got the results i found out that it is not reporting all the data correctly. On computers that have multiple installs of the service, the script is given errors of “System.Object”. Is there any way to get it so it reports all the services that meet my search criteria. I am basically trying to find what computers need to have the extra services uninstalled as it is causing issues having them all running.
If i use $ServiceList then the csv file is blank. If i change it to $ServiceSearch then the headers and computer name displays but the service names are blank. So to me it is acting like it cant find the service.