It looks like not all of my inquiry got posted. Only the first part is showing. I will attempt to post it again. Here goes.
I am using Windows “sc” command line program to query the status of services of a particular software that is installed in Windows 2008 server environment.
The problem I am having is this; these service names have spaces which cause the system to return no result or it just hangs and I have to do a control C to break out of the command. I tried putting quotes around the name but still no result.
What I find strange is when I run the command locally, with the quotes around the name, it works find. Example when I type the below statement I received the below Result;
Statement: SC QUERY “Service Name With Spaces” | FIND “STATE” | FIND “STOPPED”
Result : STATE : 4 RUNNING
However the below 2 statement examples, which include the server name where I want to check these services, returns nothing.
SC \\ServerName QUERY “Service Name With Spaces” | FIND “STATE” | FIND “STOPPED”
SC \\ServerName QUERY “Service Name With Spaces” | FIND “STATE”
There are other services on that same server that do not have spaces and I have no problem when I do a query on those, only with the ones with spaces in the name.
Has anyone encountered this problem and is there a work around.
Thanks for any help you can give.
I would try using %20 instead of a space if quotes aren’t working. Alternativly you could just use a remote management connection to check if the service is OK. Go to services on your machine and right click where it says ‘Services (local)’ and connect to another computer. It’s not as quick as something like the sc command bumped into a script or batch file but it does work and gives a good GUI if anything is wrong.
(It could be 20%, can’t remember exactly. Google it)