Anyone know about the error codes for
Win32_Service StopService? I'm getting error 4
when trying to stop some services. The description
of that error is "Invalid Service Control", which tells
me nothing. I'm trying to figure out what actually
causes error 4. (I asked in the WMI group but
it seems to be rather sleepy over there, with
little activity.)

Running as only user, with full control, on XP.
I think, if I remember correctly, it was trying to
stop WebClient that raised the error.

Re: WMI StopService by Jeffery

Jeffery
Wed Dec 05 05:09:51 PST 2007

You may be trying to stop a service that can't be stopped or is hung. What
happens if you use SC.EXE from the command line to stop the service?

--
Jeffery Hicks
Microsoft PowerShell MVP
http://www.scriptinganswers.com
http://www.powershellcommunity.org

Now Available: WSH and VBScript Core: TFM
Coming Soon: Windows PowerShell: TFM 2nd Ed.

"mayayana" <mayaXXyana1a@mindXXspring.com> wrote in message
news:uTEJKKsNIHA.5224@TK2MSFTNGP02.phx.gbl...
> Anyone know about the error codes for
> Win32_Service StopService? I'm getting error 4
> when trying to stop some services. The description
> of that error is "Invalid Service Control", which tells
> me nothing. I'm trying to figure out what actually
> causes error 4. (I asked in the WMI group but
> it seems to be rather sleepy over there, with
> little activity.)
>
> Running as only user, with full control, on XP.
> I think, if I remember correctly, it was trying to
> stop WebClient that raised the error.
>
>

Re: WMI StopService by mayayana

mayayana
Wed Dec 05 06:20:12 PST 2007


> You may be trying to stop a service that can't be stopped or is hung.
What
> happens if you use SC.EXE from the command line to stop the service?
>

Thanks. That at least narrows it down a bit. I don't
know what sc.exe is. I'll figure it out and give that a
try, though I want to do it all from within script
eventually - to the extent possible.



Re: WMI StopService by Jeffery

Jeffery
Wed Dec 05 07:22:39 PST 2007

SC is a command line tool for managing services. I'm only suggesting it as a
means to troubleshoot your issue.

--
Jeffery Hicks
Microsoft PowerShell MVP
http://www.scriptinganswers.com
http://www.powershellcommunity.org

Now Available: WSH and VBScript Core: TFM
Coming Soon: Windows PowerShell: TFM 2nd Ed.

"mayayana" <mayaXXyana1a@mindXXspring.com> wrote in message
news:Ovgrmo0NIHA.5860@TK2MSFTNGP04.phx.gbl...
>
>> You may be trying to stop a service that can't be stopped or is hung.
> What
>> happens if you use SC.EXE from the command line to stop the service?
>>
>
> Thanks. That at least narrows it down a bit. I don't
> know what sc.exe is. I'll figure it out and give that a
> try, though I want to do it all from within script
> eventually - to the extent possible.
>
>

Re: WMI StopService by Waydaws

Waydaws
Wed Dec 05 20:21:05 PST 2007

On Dec 4, 2:09 pm, "mayayana" <mayaXXyan...@mindXXspring.com> wrote:
> Anyone know about the error codes for
> Win32_Service StopService? I'm getting error 4
> when trying to stop some services. The description
> of that error is "Invalid Service Control", which tells
> me nothing. I'm trying to figure out what actually
> causes error 4. (I asked in the WMI group but
> it seems to be rather sleepy over there, with
> little activity.)
>
> Running as only user, with full control, on XP.
> I think, if I remember correctly, it was trying to
> stop WebClient that raised the error.

Hi I think that error 4 would be a standard win32 error. NET HELPMSG
4 will give you what the error means, in that case.
It would mean "The system cannot open the file." I bet that still
doesn't help you ;-)

Re: WMI StopService by mayayana

mayayana
Thu Dec 06 05:56:29 PST 2007


> Hi I think that error 4 would be a standard win32 error. NET HELPMSG
> 4 will give you what the error means, in that case.
> It would mean "The system cannot open the file." I bet that still
> doesn't help you ;-)

No, but you get an "A" for sense of humor. :)
I'm curious, though, what "NET HELPMSG" means.
Is that some sort of command line applet?

I explored this more last night and I think I
may have figured it out. According to the docs,
any error up to 24 is coming from WMI. I also
found a list of slightly better error descriptions.

(It's strange how MS has such a great system
of error returns for functions, but they barely
make the error names available, much less the
real meaning.)

I found this for error 4:
"The requested control code is not valid, or it is unacceptable to the
service."

I had got error 4 trying to disable WebClient.
When I looked in the services window last night,
WebClient was disabled. So I set it to manual and
re-ran my script, disabling WebClient and 20-odd
other services. This time the script checked the current
status first and then proceeded with the disable call
only if the service was not already disabled. It worked
without error. So, I'm not certain yet, but it appears
that error 4 can happen when one tries to set a service
(ChangeStartMode) to the same mode it's currently in.

I don't know whether there are many people who
care about all of this, but just in case, I'm pasting
in the better list of error descriptions I found for
ChangeStartMode, StopService, StartService.

1 - The request is not supported. 2 - The user did not have the necessary
access. 3 - The service cannot be stopped because other services that are
running are dependent on it. 4 - The requested control code is not valid, or
it is unacceptable to the service. 5 - The requested control code cannot be
sent to the service because the state of the service
(Win32_BaseService:State) is equal to 0, 1, or 2. 6 - The service has not
been started. 7 - The service did not respond to the start request in a
timely fashion. 8 - Unknown failure when starting the service. 9 - The
directory path to the service executable was not found. 10 - The service is
already running. 11 - The database to add a new service is locked. 12 - A
dependency for which this service relies on has been removed from the
system. 13 - The service failed to find the service needed from a dependent
service. 14 - The service has been disabled from the system. 15 - The
service does not have the correct authentication to run on the system. 16 -
This service is being removed from the system. 17 - There is no execution
thread for the service. 18 - There are circular dependencies when starting
the service. 19 - There is a service running under the same name. 20 - There
are invalid characters in the name of the service. 21 - Invalid parameters
have been passed to the service. 22 - The account, which this service is to
run under is either invalid or lacks the permissions to run the service.
23 - The service exists in the database of services available from the
system. 24 - The service is currently paused in the system. Other - For
integer values other than those listed above, refer to Win32 error code
documentation. defined in Win32_Service.



Re: WMI StopService by Waydaws

Waydaws
Thu Dec 06 22:02:12 PST 2007

On Dec 6, 5:56 am, "mayayana" <mayaXXyan...@mindXXspring.com> wrote:
> > Hi I think that error 4 would be a standard win32 error. NET HELPMSG
> > 4 will give you what the error means, in that case.
> > It would mean "The system cannot open the file." I bet that still
> > doesn't help you ;-)
>
> No, but you get an "A" for sense of humor. :)
> I'm curious, though, what "NET HELPMSG" means.
> Is that some sort of command line applet?
>
> I explored this more last night and I think I
> may have figured it out. According to the docs,
> any error up to 24 is coming from WMI. I also
> found a list of slightly better error descriptions.
>
> (It's strange how MS has such a great system
> of error returns for functions, but they barely
> make the error names available, much less the
> real meaning.)
>
> I found this for error 4:
> "The requested control code is not valid, or it is unacceptable to the
> service."
>
> I had got error 4 trying to disable WebClient.
> When I looked in the services window last night,
> WebClient was disabled. So I set it to manual and
> re-ran my script, disabling WebClient and 20-odd
> other services. This time the script checked the current
> status first and then proceeded with the disable call
> only if the service was not already disabled. It worked
> without error. So, I'm not certain yet, but it appears
> that error 4 can happen when one tries to set a service
> (ChangeStartMode) to the same mode it's currently in.
>
> I don't know whether there are many people who
> care about all of this, but just in case, I'm pasting
> in the better list of error descriptions I found for
> ChangeStartMode, StopService, StartService.
>
> 1 - The request is not supported. 2 - The user did not have the necessary
> access. 3 - The service cannot be stopped because other services that are
> running are dependent on it. 4 - The requested control code is not valid, or
> it is unacceptable to the service. 5 - The requested control code cannot be
> sent to the service because the state of the service
> (Win32_BaseService:State) is equal to 0, 1, or 2. 6 - The service has not
> been started. 7 - The service did not respond to the start request in a
> timely fashion. 8 - Unknown failure when starting the service. 9 - The
> directory path to the service executable was not found. 10 - The service is
> already running. 11 - The database to add a new service is locked. 12 - A
> dependency for which this service relies on has been removed from the
> system. 13 - The service failed to find the service needed from a dependent
> service. 14 - The service has been disabled from the system. 15 - The
> service does not have the correct authentication to run on the system. 16 -
> This service is being removed from the system. 17 - There is no execution
> thread for the service. 18 - There are circular dependencies when starting
> the service. 19 - There is a service running under the same name. 20 - There
> are invalid characters in the name of the service. 21 - Invalid parameters
> have been passed to the service. 22 - The account, which this service is to
> run under is either invalid or lacks the permissions to run the service.
> 23 - The service exists in the database of services available from the
> system. 24 - The service is currently paused in the system. Other - For
> integer values other than those listed above, refer to Win32 error code
> documentation. defined in Win32_Service.

Well that makes sense! Can't stop a service that is stopped so you get
the invalid service control is not valid. Yeah, guess we should have
checked msdn for the service specific codes in the first place:

http://msdn2.microsoft.com/en-us/library/aa393673.aspx

Well, at least it's a lesson learned, and I'll take it into account
when I end up doing that. Check status first before controlling.

Anyway, net helpmsg error-code is just one of the options to the NET
command (as in NET use, or NET session, NET print...). As you
mentioned, that wasn't for win32service. I find it helpful if you
look at an iis log, it's reports a Win32_status field, usually it just
verifies what the protocol (http, ftp..) error would be.


Re: WMI StopService by mayayana

mayayana
Fri Dec 07 05:55:56 PST 2007

> Anyway, net helpmsg error-code is just one of the options to the NET
> command (as in NET use, or NET session, NET print...). As you
> mentioned, that wasn't for win32service. I find it helpful if you
> look at an iis log, it's reports a Win32_status field, usually it just
> verifies what the protocol (http, ftp..) error would be.
>

Thanks. Could you point me to info. about that?
I don't know what you're talking about. I've no
experience with Windows servers and am only just
getting around to delving into the details of XP.
There seem to be a lot of network admins who hang
around here and who like to use various command line
utilities, but most of that sort of thing is new to me.



Re: WMI StopService by Paul

Paul
Fri Dec 07 17:09:14 PST 2007


"mayayana" <mayaXXyana1a@mindXXspring.com> wrote in message
news:uBKGQkNOIHA.1168@TK2MSFTNGP02.phx.gbl...
>> Anyway, net helpmsg error-code is just one of the options to the
>> NET
>> command (as in NET use, or NET session, NET print...). As you
>> mentioned, that wasn't for win32service. I find it helpful if you
>> look at an iis log, it's reports a Win32_status field, usually it
>> just
>> verifies what the protocol (http, ftp..) error would be.
>>
>
> Thanks. Could you point me to info. about that?
> I don't know what you're talking about. I've no
> experience with Windows servers and am only just
> getting around to delving into the details of XP.
> There seem to be a lot of network admins who hang
> around here and who like to use various command line
> utilities, but most of that sort of thing is new to me.

On XP, in help & support, search for command line reference a-z. You
should find a very close match. When you click that link, it opens
C:\WINDOWS\Help\ntcmds.chm in a sub window of Help & Support, but you
can open that file in its own window so less of your screen is wasted.
You will find info on a wide variety of handy tools that comes with
Windows.

-Paul Randall



Re: WMI StopService by mayayana

mayayana
Sat Dec 08 15:09:36 PST 2007

> On XP, in help & support, search for command line reference a-z. You
> should find a very close match. When you click that link, it opens
> C:\WINDOWS\Help\ntcmds.chm in a sub window of Help & Support, but you
> can open that file in its own window so less of your screen is wasted.
> You will find info on a wide variety of handy tools that comes with
> Windows.
>
Thanks. I removed PCHealth, which seems
to demolish Help and Support, but maybe I
can track down that file. (I never guessed
that I might actually want Windows help for
something. :)