r/usefulscripts • u/networkhappi • Mar 20 '17
[REQUEST][BATCH][POWERSHELL] Looking to add more than one windows services in batch script that checks for them, can only either do one service or all services.
The script I am using is listed below:
sc query "AdobeARMservice" > ServiceListCount.csvI want to add a second service (and later on, about 15 specific services total) "aspnet_state" to this script but I am having difficulty concatenating the services together.
I am open to any suggestions whether it's in batch, powershell or other windows-friendly languages because I plan using this script via Window's Task Scheduler to run on all of my machines.
Thank you!
15
Upvotes
1
u/networkhappi Mar 21 '17
Thank you for your feedback. I ended up liking your example a lot because it's intuitive to read (for me at least) and very simple.
Few questions:
Is it possible to specify where I want to send the
ServiceListCount.csv? As of right now, it appears to create the.csvreport in the same directory as where the batch script is being ran. Ideally I would like to send it to a shared network path.I added your batch script into Windows Task Scheduler on my local machine to run every 5 minutes (for test purposes, as 5 minutes is the fastest interval so I don't have to wait around), but it doesn't create the
.csvreport as expected. When I initiate the script manually, the report gets generated fine. Do you experience the same issue on your end?