G
Guest
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.
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.