PC Review


Reply
Thread Tools Rate Thread

Changing Service types using a script

 
 
=?Utf-8?B?cGF0X3NtaXRoMTk2OQ==?=
Guest
Posts: n/a
 
      26th Apr 2005
I have a script that changes the service type from disabled to automatic for
a given service. My test service is "themes" but it has the same behavior
regardless of which service you chose.

My script is as follows...

$Key = "HKLM\SYSTEM\CurrentControlSet\Services\"
$ServiceState = ReadValue ($key + "Themes", "Start")
?" themes: " + $ServiceState
If $ServiceState <> "2"
WriteValue ($key + "Themes", "Start", "2", "REG_DWORD")
EndIF

This script does as it should.. that is it will change the type from
disabled to Automatic. The problem is that you cannot start the service
afterwards, it believes it is still disabled and gives a 1058 error "service
is disabled". I have checked and the registry has a "2" listed where it
should.

The script simply changes the registry value from 4 to 2 under "start". If I
do a regedit and manually change the value from 4 to 2 it works. If I open up
the Service tool and go to properties and change the value from "disabled" to
"automatic" it works as well. It only fails if I use any kind of script to
change it from 4 to 2.

Also at the same time I get an Event ID 10005 in the system log...

DCOM got error "The service cannot be started, either because it is disabled
or because it has no enabled devices associated with it. " attempting to
start the service AeXNSClient with arguments "-Service" in order to run the
server:
{9EB55EF4-BD5A-4149-B42F-8CD8A6755B2D}

Any ideas what is wrong... I have seen others use this exact same script and
they have no issues.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?cGF0X3NtaXRoMTk2OQ==?=
Guest
Posts: n/a
 
      26th Apr 2005
Please note...
In the DCOM error I posted I was working with the AeXHSClient service and
not Themes. But the behavior remains the same regardless which service I am
working with.

 
Reply With Quote
 
Mark V
Guest
Posts: n/a
 
      27th Apr 2005
In microsoft.public.win2000.registry
=?Utf-8?B?cGF0X3NtaXRoMTk2OQ==?= wrote:

> Please note...
> In the DCOM error I posted I was working with the AeXHSClient
> service and not Themes. But the behavior remains the same
> regardless which service I am working with.


Purely speculative but I am assuming that since your script bypasses
service control manager that the system is not made aware of the
changes adequately. I suggest using the SC.exe tool or equivalent
tools or API functions to alter a service's configuration.
 
Reply With Quote
 
=?Utf-8?B?cGF0X3NtaXRoMTk2OQ==?=
Guest
Posts: n/a
 
      27th Apr 2005
Mark V...
You are absolutely correct. I used a new script that used a WMI interface
and it worked great. Thanks for your help.

"Mark V" wrote:

> In microsoft.public.win2000.registry
> =?Utf-8?B?cGF0X3NtaXRoMTk2OQ==?= wrote:
>
> > Please note...
> > In the DCOM error I posted I was working with the AeXHSClient
> > service and not Themes. But the behavior remains the same
> > regardless which service I am working with.

>
> Purely speculative but I am assuming that since your script bypasses
> service control manager that the system is not made aware of the
> changes adequately. I suggest using the SC.exe tool or equivalent
> tools or API functions to alter a service's configuration.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing Service types using a script =?Utf-8?B?cGF0X3NtaXRoMTk2OQ==?= Microsoft Windows 2000 Registry Archive 3 27th Apr 2005 11:21 PM
Changing types of charts. Axiom Microsoft Excel Charting 2 24th May 2004 03:11 PM
Need help changing data types Elisa Microsoft Access Queries 0 30th Oct 2003 07:53 PM
Changing location of Emit built types when running as a Windows service Urs Vogel Microsoft C# .NET 1 30th Oct 2003 11:51 AM
Changing field types... Tara Microsoft Access Database Table Design 1 26th Aug 2003 10:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:18 AM.