Sign in to follow this  
Followers 0
steff

Issue in Setting remote service password

3 posts in this topic

Hello all, guys,

I need to write a script to install a package on remote Windows XP PRO SP3 systems. This package configures a service which copies files to a remote folder: this folder is shared to be accessed solely by a privileged users, and thus the remote service needs to run as that particular specific user (as far as I know).

The script I wrote runs on a Windows 2003 server, remotely installs the package using PSEXEC, and connects to the remote PC to change the account and password by which the service is run.

After changing this, it remotely tries to start the service.

It happens that, for some machines (and I mean not all of my clients, but more then a few), the user is correctly configured, but not the password.

This is happening both whan I use the Services.au3 UDF and when I use a simple SC command in my au3 program.

1st example: using Services UDF

#Include <Services.au3>

$sServiceName="ServiceName"
$passwd="Password"
$admin_user="domain\admin"
$pcname="pcname"
                    
$status= _Service_SetAccount($sServiceName, $admin_user , $passwd, $pcname)

2nd example: using SC command

$sServiceName="ServiceName"
$passwd="Password"
$admin_user="domain\admin"
$pcname="pcname"
$cmd='sc \\' & $pcname & ' config ServiceName start= auto obj= "' &  $admin_user] & '" password= "' & $passwd & '"'

After running the command, as said before, on some systems the service does not start.

I connect to those PCs where the service doesn't run, try to start the service and I got an error such as:

Could not start the ServiceName service on Local Computer.

Error 1069: The service did not start due to a logon failure.

Then, I change the Logon password for that service (MSC Services -> Service Properties -> Log On -> This account - Password), start the service and everything works.

I can't explain this weirdness.

I guess it's more a Windows problem than an Autoit issue, so I'm investigating on other source of information. But I really don't know.

Does anybody have any idea?

Thanks in advance for all replies

cheers

stef

Share this post


Link to post
Share on other sites



After some research, I found this answer in another forum: http://efreedom.com/Question/1-155695/ChangeServiceConfig-Problem-Setting-Logon-Credentials

The user account must explicitly have rights to log on as a service (SeServiceLogonRight). Many users, including computer admins, may not have this flag set, and you may need to set it manually. The windows services control panel actually does this silently behind the scenes when you use it to configure services.

So, it's a matter or configuring Local Policy in the Group Policy and setting the user to have rights to log on as a service.

Hope this helps who will have the same problem.

Share this post


Link to post
Share on other sites

AS you wrote it I remembered...

*doh* :huh2:


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0