Edit windows service user with a batch script and encrypted password

1

I need to change the user of a service on Windows using a batch script. Searching the web I found this solution:

sc \\server config ServiceName obj= Domain\user password= pass

The problem is, that i'm not allowed to share the password with the guy that deploys the software. Can I encrypt it somehow?

RazziaDK

Posted 2015-02-18T11:24:51.223

Reputation: 11

Answers

1

That is, the person adds the service and have the right to install the software and you are afraid that he sees password?)))

I'm sorry, its current rights is much greater than the rights of the user password.

But you can look over here Encrypt your password in TFS Build using Certificates

What below makes little sense, but can be fun. Use powershell as C# runnable application, powershell script compile to HelloWorld.exe:

Run, and get HelloWorld.exe

powershell .\Hello.ps1

Hello.ps1:

Add-Type -Language CSharpVersion3 -ea 0 -OutputType ConsoleApplication -OutputAssembly HelloWorld.exe @'

using System;

  public class helloWorld
  {
        public static void Main(string[] args)
        {
              Console.WriteLine("Hello World");

        } 
  }  
'@

Good way:

Not need password.

Soap application

STTR

Posted 2015-02-18T11:24:51.223

Reputation: 6 180

It's a bit more complex. In our company all software is distributed as packages and later on deployed to workstations and servers.

I ask for people to pack the software. That department then wraps it as a package and gives the rights to execute on the servers/workstations.

To make it even more bizar - I may not know the password myself. I know about the software and tells some people how to install it. Other people wrap it as a packages and our security department adds the password.

Seperation is required in the industry :-( – RazziaDK – 2015-02-18T12:48:00.203

Come to think of it - I think I might find some software that can convert a .bat file to a .exe file.

Then our security department can create the exe file, and the softwaredistribution guys can execute it after the software has been installed. – RazziaDK – 2015-02-18T13:01:57.583

@RazziaDK Need very little knowledge to change the package. What prevents distribute software for organizational units through the active directory? This narrows the area LIABILITY up to a single unit that enhances safety. It automates the installation on groups of workstations simultaneously, which reduces installation time and labor. – STTR – 2015-02-18T13:43:30.940

@RazziaDK Update, but i think best way create C++ or C# application, not powershell script). – STTR – 2015-02-18T14:12:56.873