I currently have a powershell script that searches all my computers that are listed in a text document for a service that is listed in another text document.
and then it displays if the service is running or stopped or not installed.
What I need to do is set it up so that if the service is stopped the script will delete the service from the computer.
Manually I can do this with SC \\servername delete "servicename" then problem is I have over 5000 computers and I do not want to do this for every machine.
The other issue is I just can not enter in the servicename as it is different on each machine since the program that installs the service is setup so after the name it adds a timestamp to the name.
So in a nutshell I need the script to basically scan each computer in an txt document 1 for "servicename*" in txt document 2 if it returns stopped delete
and then it displays if the service is running or stopped or not installed.
What I need to do is set it up so that if the service is stopped the script will delete the service from the computer.
Manually I can do this with SC \\servername delete "servicename" then problem is I have over 5000 computers and I do not want to do this for every machine.
The other issue is I just can not enter in the servicename as it is different on each machine since the program that installs the service is setup so after the name it adds a timestamp to the name.
So in a nutshell I need the script to basically scan each computer in an txt document 1 for "servicename*" in txt document 2 if it returns stopped delete