Win32 Service Logon Failure

A

Ashish Deepak4

Hi Guys,

I desperately need help with this as I can't understand why it is
working.

I am trying to create windows service using win32/service with a
specific user login. I have provided the username and password correctly
in my ruby script.

Essentially, when i run the script below it successfully creates the
service. But fails to start saying "Logon Failure" message. However,
if I go to the windows service window (services.msc) and right click
service and then go to properties->Log On and enter the same password
and then start the service it all works fine.
Please help if you have ever encounter this before? I do not understand
what is going on. (I am logged in as Adminstrator when I run this
script)

myService.ruby
------------------------------------------------------------------------

require "win32/service"
include Win32

Service.create("MyService", nil,
:description => "My Ruby Service",
:start_type => Service::AUTO_START,
:error_control => Service::ERROR_NORMAL,
:binary_path_name => "C:\myService.exe",
:display_name => "MyService",
:service_start_name => "domain\\myUser",
:password => "myPass",
:service_type=> Service::SERVICE_WIN32_OWN_PROCESS
)


Service.start("MyService")
 
A

Ashish Deepak4

Ashish Deepak4 wrote in post #979326:
Hi Guys,

I desperately need help with this as I can't understand why it is
working.

I am trying to create windows service using win32/service with a
specific user login. I have provided the username and password correctly
in my ruby script.

Essentially, when i run the script below it successfully creates the
service. But fails to start saying "Logon Failure" message. However,
if I go to the windows service window (services.msc) and right click
service and then go to properties->Log On and enter the same password
and then start the service it all works fine.
Please help if you have ever encounter this before? I do not understand
what is going on. (I am logged in as Adminstrator when I run this
script)

myService.ruby
------------------------------------------------------------------------

require "win32/service"
include Win32

Service.create("MyService", nil,
:description => "My Ruby Service",
:start_type => Service::AUTO_START,
:error_control => Service::ERROR_NORMAL,
:binary_path_name => "C:\myService.exe",
:display_name => "MyService",
:service_start_name => "domain\\myUser",
:password => "myPass",
:service_type=> Service::SERVICE_WIN32_OWN_PROCESS
)


Service.start("MyService")

Found the solution.
You have to grant the user the SeServiceLogonRight permission first
before staring the service.
I did this using ntrights.exe.

Found following pages helpful:
http://www.questionhub.com/ServerFault/197881
http://support.microsoft.com/kb/315276
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,056
Messages
2,570,441
Members
47,119
Latest member
NoeliaIrby

Latest Threads

Top