Installing a windows service on remote machine using given username

后端 未结 4 2025
无人及你
无人及你 2020-12-08 05:44

What is the best way to install a windows service written in C# (in the standard way) on a remote machine, where I need to provide the username and password it should run as

4条回答
  •  感情败类
    2020-12-08 06:06

    You can use the SC command.

    sc.exe \\remotecomputer create newservice binpath= C:\Windows\System32\Newserv.exe start= auto obj= DOMAIN\username password= pwd

    (Note the spaces after the equals signs are important)

    Creates a service entry in the registry and Service Database.
    SYNTAX: 
    sc create [service name] [binPath= ]  ...
    CREATE OPTIONS:
    NOTE: The option name includes the equal sign.
     type= 
           (default = own)
     start= 
           (default = demand)
     error= 
           (default = normal)
     binPath= 
     group= 
     tag= 
     depend= 
     obj= 
           (default = LocalSystem)
     DisplayName= 
     password=  
    

提交回复
热议问题