From: Luis Lavena Date: 2010-04-15T21:10:12+09:00 Subject: Re: Win32 Service: Access Denied when creating service On Apr 15, 8:10 am, Rajiv Abraham wrote: > Rajiv Abraham wrote: > > Hi, > > I am trying to create and register a windows service with the following > > code. > > > require "rubygems" > > require "win32/service" > >    include Win32 > > svc = Service.new(:service_name => "rajiv_service_name") > > > Error: > > C:/Ruby/lib/ruby/gems/1.8/gems/win32-service-0.7.1-x86-mswin32-60/lib/win32 /service.rb:368:in > > `initialize': Access is denied. (Win32::Service::Error) > >         from > > C:/Users/Rajiv/Documents/NetBeansProjects/MusicClockService/lib/register_ba r_1.rb:9:in > > `new' > >         from > > C:/Users/Rajiv/Documents/NetBeansProjects/MusicClockService/lib/register_ba r_1.rb:9 > > > I tried changing to: > > > svc = Service.new(:service_name =>SERVICE_NAME, > >                   :service_start_name => "HOME\\Rajiv", > >                   :password => "my_pwd" ) > > > but it still did not work. > > > Thanks, > > Rajiv > > Just adding to the previous post, if it helps: > - I installed the win32-services gem using gem install win32-service > --platform=mswin32 > - The doc. says that only :service_name is mandatory. So, it is bit > surprising that it does not work > - User Rajiv is Administrator Is the prompt from where are you invoking the ruby script running with elevated privileges? On Vista and 7 even when user is Administrator it needs UAC elevation to properly modify registry related to system -- Luis Lavena