With most commands, an ErrorLevel greater than 0 indicates a
failure of some sort. It's the same with net.exe. With "net start"
2 could mean that the service was already running, or that there
is no such service, and probably a few other error conditions too.
-Paul Randall
"Gareth Cornish" <Gareth...@discussions.microsoft.com> wrote in
message news:1A365C9B-5CA1-47A0...@microsoft.com...
I found a reference to NET HELPMSG with a google search. I hadn't
known about it before this, though it appears to be a standard command
console utility. When I checked the Windows help for HELPMSG I found
this example ...
NET 2182: The requested service has already been started.
which suggests that an error code of 2 is not related to a started
service error. In fact, when I checked NET HELPMSG 2 it returned ...
The system cannot find the file specified.
I also not that there are MANY, MANY error levels returned from NET,
since its error codes run to four digits (up to 10,000 possibilities,
though there is not an error for every value) so it's just not
practical to provide an exhaustive list. Rather, you'll need to trap
the error and then use NET HELPMG to deliver an explanation.
Tom Lavedas
===========
Best to use the WMI method that D.R. posted in another
branch of this thread. They are very detailed.