Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing Windows Service with SC

I am installing some services with the installutils command but I'm having immense trouble in getting these to install using the SC create command. What is the difference between the two modes. I'm getting no error from the command, but a series of options. Here is the format I am using:

SC create ZAM displayname= "ZAM" binpath="E:\ZAM\ZAM.exe" start=auto 

and I get the following:

DESCRIPTION:
        Creates a service entry in the registry and Service Database.
USAGE:
        sc <server> create [service name] [binPath= ] <option1> <option2>...

OPTIONS:
NOTE: The option name includes the equal sign.
      A space is required between the equal sign and the value.
 type= <own|share|interact|kernel|filesys|rec>
       (default = own)
 start= <boot|system|auto|demand|disabled|delayed-auto>
       (default = demand)
 error= <normal|severe|critical|ignore>
       (default = normal)
 binPath= <BinaryPathName>
 group= <LoadOrderGroup>
 tag= <yes|no>
 depend= <Dependencies(separated by / (forward slash))>
 obj= <AccountName|ObjectName>
       (default = LocalSystem)
 DisplayName= <display name>
 password= <password>

I don't understand what could be going wrong?

like image 599
disruptive Avatar asked Jan 26 '26 01:01

disruptive


1 Answers

Instead of calling 'sc' directly, I recommend using New-Service. The parameters are a direct translation. It is available in the default powershell modules.

like image 72
Eris Avatar answered Jan 27 '26 16:01

Eris



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!