List Info

Thread: Re: win32-service of win32utils




Re: win32-service of win32utils
country flaguser name
United States
2007-09-20 19:35:10
Ah, excellent. Glad you got it figured out!

Regards,

Dan

Yuhong Liu wrote:
> Hi Dan,
> 
> I think I have figured out the problem. The issue is
because of the 
> setting of service type. So by default the service type
is set as 
> Service::WIN32_OWN_PROCESS |
Service::INTERACTIVE_PROCESS. This means 
> the service is configured to interact with the desktop,
you cannot 
> change the service to run under a domain user account.
So I changed the 
> code of configuring service by setting service type as
WIN32_OWN_PROCESS.
> 
> s.configure_service{ |s|
> s.start_name = "name of the account" 
> s.password = "password"
> s.service_type = Service::WIN32_OWN_PROCESS
> }
> 
> Then it works now.
> 
> Thank you very much for the help.
> 
> Kay
> 
>  > Date: Wed, 19 Sep 2007 20:33:30 -0600
>  > From: djberg96gmail.com
>  > To: serphakayhotmail.com
>  > Subject: Re: win32-service of win32utils
>  >
>  > Hi Kay,
>  >
>  > Just to be clear, you tried
"domain_name\user_name" and it didn't work?
>  >
>  > Regards,
>  >
>  > Dan
>  >
>  > Kay wrote:
>  > > I'm writing some scripts to programmatically
change the user 
> account of running a windows service. So I downloaded
one of the windows 
> utilities, win32-service, and wrote my scripts. However
when I was 
> trying to use the following scripts to change the name
of the account of 
> running a windows service
>  > >
>  > >
>  > >
>  > > s.configure_service{ |s|
>  > >
>  > > s.start_name = "name of the
account"
>  > >
>  > > s.password = "password" # Note
that I used plain text password
>  > >
>  > > }
>  > >
>  > >
>  > >
>  > > I was always given some kinds of error
messages, which varied based 
> on different formats of the account name being used.
So
>  > >
>  > >
>  > >
>  > > with start_name =
"domain_nameuser_name" (using  for escaping and

> have tried domain_name with either upper case or lower
case), the 
> message is "the parameter is incorrect".
>  > >
>  > >
>  > >
>  > > with start_name =
"domain_nameuser_name" (have tried domain_name 
> with either upper case or lower case), the message is
"the account name 
> is invalid or does not exist, or the password is
invalid for the account 
> name specified".
>  > >
>  > >
>  > >
>  > > with start_name = "user_namedomain_name.com", the message is " the 
> parameter is incorrect".
>  > >
>  > >
>  > >
>  > > with start_name = "user_nameanother_domain_name.com", 
> (another_domain_name is a possible domain name for me),
the message is 
> "the specified domain either does not exist or
could not be contacted".
>  > >
>  > >
>  > >
>  > > with start_name = "user_name", the
message is "the account name is 
> invalid or does not exist, or the password is invalid
for the account 
> name specified".
>  > >
>  > >
>  > >
>  > > So I'm writing to ask for your suggestions.
BTW, do you think it's 
> right to use password in plain text? Your help is very
appreciated. The 
> following is a full script I was using.
>  > >
>  > >
>  > >
>  > > base = File.basename(Dir.pwd)
>  > >
>  > > if base == "examples" || base =~
/win32-service/
>  > >
>  > > require "ftools"
>  > >
>  > > Dir.chdir("..") if base ==
"examples"
>  > >
>  > > Dir.mkdir("win32") unless
File.exists?("win32")
>  > >
>  > >
File.copy("service.so","win32")
>  > >
>  > > $LOAD_PATH.unshift Dir.pwd
>  > >
>  > > end
>  > >
>  > >
>  > >
>  > > require "win32/service"
>  > >
>  > > include Win32
>  > >
>  > >
>  > >
>  > > s = Service.new("machine_name")
>  > >
>  > >
>  > >
>  > > # Create a new service
>  > >
>  > >
>  > >
>  > > if Service.exists?("foo")
>  > >
>  > > Service.delete("foo")
>  > >
>  > > end
>  > >
>  > >
>  > >
>  > > s.create_service{ |s|
>  > >
>  > > s.service_name = "foo"
>  > >
>  > > s.binary_path_name = 
>
"C:AutonomyDocumentumFetchOldDocumentumFetchOld.exe&
quot;
>  > >
>  > > s.display_name = "My Foo Service"
>  > >
>  > > }
>  > >
>  > >
>  > >
>  > >
>  > >
>  > > # Configure a service that already exists
>  > >
>  > > s.configure_service{ |s|
>  > >
>  > > s.start_name = "start_name"
>  > >
>  > > s.password = "password"
>  > >
>  > > }
>  > >
>  > >
>  > >
>  > > s.close
>  > >
>  > >
>  > >
>  > > Service.start("foo")
>  > >
>  > > Service.pause("foo")
>  > >
>  > > Service.resume("foo")
>  > >
>  > > Service.stop("foo")
>  > >
>  > >
>  > >
>  > > Service.delete("foo")
>  > >
>  > >
>  > >
>  > > Service.getdisplayname("Schedule")
# "Task Scheduler"
>  > >
>  > > Service.getservicename("ClipBook")
# "ClipSrv"
>  > >
>  > >
>  > >
>  > > s = Service.status("ClipSrv")
>  > >
>  > >
>  > >
>  > > # Enumerate over all services, inspecting
each struct
>  > >
>  > > Service.services{ |s|
>  > >
>  > > p s
>  > >
>  > > puts
>  > >
>  > > }
>  > >
>  > >
>  > >
>  > > Thanks!
>  > >
>  >
> 
>
------------------------------------------------------------
------------
> Invite your mail contacts to join your friends list
with Windows Live 
> Spaces. It's easy! Try it! 
> <http://spaces.l
ive.com/spacesapi.aspx?wx_action=create&wx_url=/friends.
aspx&mkt=en-us>

_______________________________________________
win32utils-devel mailing list
win32utils-develrubyforge.org
http://rubyforge.org/mailman/listinfo/win32utils-devel


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )