List Info

Thread: Fwd: win32-service of win32utils




Fwd: win32-service of win32utils
user name
2007-09-19 12:51:39
Any ideas folks?

Thanks,

Dan

---------- Forwarded message ----------
From: Kay <serphakayhotmail.com>
Date: Sep 19, 2007 10:52 AM
Subject: win32-service of win32utils
To: djberg96gmail.com


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!
_______________________________________________
win32utils-devel mailing list
win32utils-develrubyforge.org
http://rubyforge.org/mailman/listinfo/win32utils-devel


Re: Fwd: win32-service of win32utils
user name
2007-09-19 20:34:59
Hi,

2007/9/20, Daniel Berger < djberg96gmail.com">djberg96gmail.com>:
Any ideas folks?

Thanks,

Dan

---------- Forwarded message ----------
From: Kay < serphakayhotmail.com">serphakayhotmail.com>
Date: Sep 19, 2007 10:52 AM
Subject: win32-service of win32utils
To: djberg96gmail.com">djberg96gmail.com


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&quot;

s.password = "password"&nbsp; # 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&quot;.



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&quot;.



with start_name = "user_namedomain_name.com", the message is " the
parameter is incorrect&quot;.



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&quot;.



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/

&nbsp;  require "ftools"

&nbsp;  Dir.chdir("..&quot;) if base == "examples"

 &nbsp; Dir.mkdir("win32") unless File.exists?("win32")

 &nbsp; File.copy("service.so","win32")

&nbsp;  $LOAD_PATH.unshift Dir.pwd

end



require "win32/service&quot;

include Win32



s = Service.new("machine_name&quot;)



# Create a new service



if Service.exists?(";foo")

 &nbsp;Service.delete(&quot;foo")

end



s.create_service{ |s|

s.service_name = "foo&quot;

s.binary_path_name = "C:AutonomyDocumentumFetchOldDocumentumFetchOld.exe"

s.display_name = "My Foo Service&quot;

}





# Configure a service that already exists

s.configure_service{ |s|

s.start_name = "start_name";

s.password = "password"

}



s.close



Service.start(&quot;foo&quot;)

Service.pause(&quot;foo";)

Service.resume(&quot;foo&quot;)

Service.stop(&quot;foo";)



Service.delete(&quot;foo&quot;)



Service.getdisplayname(&quot;Schedule") # "Task Scheduler&quot;

Service.getservicename (&quot;ClipBook") # "ClipSrv"



s = Service.status("ClipSrv&quot;)



# Enumerate over all services, inspecting each struct

Service.services{ |s|

p s

puts

}



Thanks!
 ;
I guess it is due to the "&quot; character escaping.
 
start_name = "domain_nameuser_name"
 
should be
&nbsp;
start_name = "domain_name\user_name";
or
start_name = 'domain_nameuser_name'
 
Regards,
 
Park Heesob
 
[1-2]

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