[ACCEPTED]-Installing a windows service on remote machine using given username-windows-services

Accepted answer
Score: 28

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 1 after the equals signs are important)

Creates a service entry in the registry and Service Database.
sc create [service name] [binPath= ] <option1> <option2>...
NOTE: The option name includes the equal sign.
 type= <own|share|interact|kernel|filesys|rec>
       (default = own)
 start= <boot|system|auto|demand|disabled>
       (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> 
Score: 1

Installutil called from WMI invoked from 1 Powershell is one way to go.

Score: 0

We used to use PsExec to do everything on remote 2 machine. At this time I saw naother solution 1 called PowerShell Remoting, but haven't tried myself.

Score: 0

It might be worth you checking out a utility 6 I wrote which lets you install/uninstall/start/stop 5 windows services on a local or remote machine. If 4 you have a feature you need added let me 3 know (comment/github issues or PM and I'll 2 happily oblige).

ServiceConfigurator on GitHub

As @Raj More suggested, it 1 uses WMI invoked from .NET.

More Related questions