Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Stop-Service cmdlet

Closed Thread
 
Thread Tools Display Modes
Old 01-30-2008   #1 (permalink)
Joachim Meyer
Guest


 

Stop-Service cmdlet


Hi,

I tried to stop the IIS Admin service using the Stop-Service cmdlet but it
is telling me that I need to use the -force switch to do so because it has
dependant services. However, the dependant service W3SVC is not running, so
I would have expected this error message to appear only in case W3SVC is
running. For instance, the net stop command asks to stop the dependant
service only if it is running, otherwise it just stops the service. Is this
behaviour by design? I find it at least weird (if not broken).

Regards
Joachim


PS C:\> spsv iisadmin
Stop-Service : Cannot stop service 'IIS Admin (IISADMIN)' because it has
dependent services. It can only be stopped if
the Force flag is set.
At line:1 char:5
+ spsv <<<< iisadmin


PS C:\> gsv iisadmin | fl


Name : IISADMIN
DisplayName : IIS Admin
Status : Running
DependentServices : {W3SVC}
ServicesDependedOn : {RPCSS, SamSS}
CanPauseAndContinue : True
CanShutdown : True
CanStop : True
ServiceType : Win32ShareProcess



PS C:\> gsv w3svc | fl


Name : W3SVC
DisplayName : World Wide Web Publishing
Status : Stopped
DependentServices : {}
ServicesDependedOn : {IISADMIN}
CanPauseAndContinue : False
CanShutdown : False
CanStop : False
ServiceType : Win32ShareProcess



PS C:\> net stop iisadmin
..
The IIS Admin service was stopped successfully.

PS C:\> gsv iisadmin | fl


Name : IISADMIN
DisplayName : IIS Admin
Status : Stopped
DependentServices : {W3SVC}
ServicesDependedOn : {RPCSS, SamSS}
CanPauseAndContinue : False
CanShutdown : False
CanStop : False
ServiceType : Win32ShareProcess

Old 01-30-2008   #2 (permalink)
Marco Shaw [MVP]
Guest


 

Re: Stop-Service cmdlet

Joachim Meyer wrote:
Quote:

>
> Hi,
>
> I tried to stop the IIS Admin service using the Stop-Service cmdlet but it
> is telling me that I need to use the -force switch to do so because it has
> dependant services. However, the dependant service W3SVC is not running, so
> I would have expected this error message to appear only in case W3SVC is
> running. For instance, the net stop command asks to stop the dependant
> service only if it is running, otherwise it just stops the service. Is this
> behaviour by design? I find it at least weird (if not broken).
Valid point. I'll submit a "bug" to Microsoft in the next few days and
post the link back here. If enough people find it to be an issue, then
Microsoft will likely address it in a future release.

Personally, I don't see this as a big issue myself.

Marco

--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
Old 01-30-2008   #3 (permalink)
Joachim Meyer
Guest


 

Re: Stop-Service cmdlet

"Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote:
Quote:

> Joachim Meyer wrote:
Quote:

>>
>> I tried to stop the IIS Admin service using the Stop-Service cmdlet but
>> it is telling me that I need to use the -force switch to do so because it
>> has dependant services. However, the dependant service W3SVC is not
>> running, so I would have expected this error message to appear only in
>> case W3SVC is running. For instance, the net stop command asks to stop
>> the dependant service only if it is running, otherwise it just stops the
>> service. Is this behaviour by design? I find it at least weird (if not
>> broken).
>
> Valid point. I'll submit a "bug" to Microsoft in the next few days and
> post the link back here. If enough people find it to be an issue, then
> Microsoft will likely address it in a future release.
Thanks.
Quote:

> Personally, I don't see this as a big issue myself.
It's not a big issue, agree, but one of the minor annoyances with the
behaviour of some of the cmdlets. In general, I like the PowerShell very
much but with some cmdlets I would have wished that they more closely model
the behaviour of existing commands you are already used to.

Joachim

Old 02-29-2008   #4 (permalink)
Ben Mc
Guest


 

Re: Stop-Service cmdlet

Hi All,

I came across this issue a long time ago using VBScript.

I think you may find that there are other dependent services that you have
to stop.
IISRESET performs three stop/starts, equivalent of:

Stop-Service "W3SVC" / "World Wide Web")
Stop-Service "SMTPSVC" / "Simple Mail Transfer Protocol (SMTP)")
Stop-Service "IISAdmin" / "IIS Adminstration")

So try this approach.

Good luck,
Ben


"Joachim Meyer" wrote:
Quote:

> "Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote:
Quote:

> > Joachim Meyer wrote:
Quote:

> >>
> >> I tried to stop the IIS Admin service using the Stop-Service cmdlet but
> >> it is telling me that I need to use the -force switch to do so because it
> >> has dependant services. However, the dependant service W3SVC is not
> >> running, so I would have expected this error message to appear only in
> >> case W3SVC is running. For instance, the net stop command asks to stop
> >> the dependant service only if it is running, otherwise it just stops the
> >> service. Is this behaviour by design? I find it at least weird (if not
> >> broken).
> >
> > Valid point. I'll submit a "bug" to Microsoft in the next few days and
> > post the link back here. If enough people find it to be an issue, then
> > Microsoft will likely address it in a future release.
>
> Thanks.
>
Quote:

> > Personally, I don't see this as a big issue myself.
>
> It's not a big issue, agree, but one of the minor annoyances with the
> behaviour of some of the cmdlets. In general, I like the PowerShell very
> much but with some cmdlets I would have wished that they more closely model
> the behaviour of existing commands you are already used to.
>
> Joachim
>
>
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
get-service cmdlet in powershell v2 (ctp) RG PowerShell 3 12-14-2007 03:43 PM
How is it possible to execute start-service and stop-service through a Web-interface? Alexander Vasilevsky PowerShell 7 11-15-2007 08:29 PM
Pipeline stop-service with -force Julian Bowker PowerShell 12 07-06-2007 07:30 AM
which service can stop at VISTA? ·ëèë Vista General 6 01-24-2007 01:17 AM
NET START STOP Service Command Line Dr. Network Vista General 3 09-26-2006 09:17 PM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50