"SC.EXE config" and dollar sign in service name

Posted by Joe Schmoe on Server Fault See other posts from Server Fault or by Joe Schmoe
Published on 2012-06-04T01:39:34Z Indexed on 2012/06/04 4:42 UTC
Read the original article Hit count: 584

Say I want to make Windows Service startup dependent on SQL Server.

In my case service name for SQL Server is MSSQL$SQL11 (SQL11 is SQL Server instance name)

However, when I issue this command:

SC.EXE config MyService depend= MSSQL$SQL11

everything after the dollar sign is ignored. When I go to "Dependencies" tab in "Services" SQL Server is not listed. When I check matching registry key it becomes clear why: it only has MSSQL. At this point I have to edit registry by hand to change MSSQL to MSSQL$SQL11 and then everything works as expected.

Putting quotes around MSSQL$SQL11 doesn't help.

Is there a way to specify $ in the middle of the SC.EXE argument string?

© Server Fault or respective owner

Related posts about windows-server-2008

Related posts about windows-service