Results 1 to 15 of 15
  1. #1
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    2,820
    Thanks
    19
    Thanked 108 Times in 102 Posts

    Re: Component Server Stop

    If you had just said you wanted to stop or start a 'Service' I would be quite happy to suggest SC or NET STOP/START (built-in) or PsService (guess)!

    Do 'Component Services' have any associated command-line utilities in, say, a Resource Kit? (You will have answered your own question if you know this, I suspect!)

    PS I am sure you are not actually 'loathed' - you might be loath to do something, though! <small>(But then again...! <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>)</small>
    BATcher

    If it wasn't for the weather, Great Britain would be a silent nation.

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Component Services Stop

    I am writing a small batch file that will drainstop a Network Load Balanced server, stop a couple of Services (not a problem), however, I am trying to Stop and Start a specific Component Service but am unsure of the syntax, or if indeed it is possible via this method. Any ideas?

    PS I am loathed to do this using WMI scripting...long story
    Jerry

  4. #3
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Component Services Stop

    Hi John, so it is you, you can't keep a Lounge Pedant down, can you <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>

    I did note in my previous question, I said it was "not a problem" meaning I know how to do Net stop commands and SC does not work with this as they mainly work with Services, these are Component Services (COM + objects) which it does not.
    Jerry

  5. #4
    Administrator
    Join Date
    Mar 2001
    Location
    St Louis, Missouri, USA
    Posts
    20,376
    Thanks
    1
    Thanked 595 Times in 532 Posts

    Re: Component Services Stop

    Do any of the articles at Automating COM+ Administration help?

    Joe

  6. #5
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Component Services Stop

    Thanks Joe

    That will be a good start, I'll have a read of this over the weekend. It has spurred me on to think of the TSKill as it it appears to use the Process ID as part of its parameter values, have you had experience of this command?
    Jerry

  7. #6
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    2,820
    Thanks
    19
    Thanked 108 Times in 102 Posts

    Re: Component Services Stop

    TSKILL works fine - I have used it by selecting what's needed from TASKLIST...
    BATcher

    If it wasn't for the weather, Great Britain would be a silent nation.

  8. #7
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Component Services Stop

    Thanks

    TSKill does work but I have realised I will have to find the PID value programmatically. I manually found the PID and used it in TSKill, but when it starts again it will obviously be a different number.

    How would you find the PID in code?
    Jerry

  9. #8
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Component Services Stop

    Thanks

    I think we may be confusing the Task List (TASKLIST) and the COM+ objects. I see no COM+ object services in the Task List and therefore I cannot use this command. However I can stop it with TSKill [PID] i.e. TSKill 2359
    Jerry

  10. #9
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    2,820
    Thanks
    19
    Thanked 108 Times in 102 Posts

    Re: Component Services Stop

    I'm only guessing, but if you can find the (unique) "image name" of the component service in the Task Manager -> Processes tab, then it will also appear in the output from TASKLIST. You just have to find it, and use TASKKILL to remove it.

    This line is from my BATch file to find CMD.EXE and remove it - your image name will differ!<pre>for /f "tokens=2" %%a in ('tasklist ^| find /i "cmd.exe"') do taskkill /pid %%a</pre>

    In passing, I note that TASKLIST is 'built in', whereas TLIST is a Resource Kit utility.

    TSKILL should be able to remove a process simply by its name, so the equivalent to my BATch file line above is simply <pre>tskill cmd</pre>

    Do you not find this?
    BATcher

    If it wasn't for the weather, Great Britain would be a silent nation.

  11. #10
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    2,820
    Thanks
    19
    Thanked 108 Times in 102 Posts

    Re: Component Services Stop

    So how do you know what the appropriate PID is - i.e. how do you find it 'manually'? If there's a different command-line utility which shows these strange creatures, then I can modify the BATch file accordingly!
    BATcher

    If it wasn't for the weather, Great Britain would be a silent nation.

  12. #11
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Component Services Stop

    That is exactly my question I asked in <post:=703,435>post 703,435</post:>

    Have a look at this screen dump to show how I view the PID
    Jerry

  13. #12
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    2,820
    Thanks
    19
    Thanked 108 Times in 102 Posts

    Re: Component Services Stop

    Ah - when you're in an MMC I'm afraid you're on your own...
    BATcher

    If it wasn't for the weather, Great Britain would be a silent nation.

  14. #13
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Component Services Stop

    Thanks for trying
    Jerry

  15. #14
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Component Services Stop

    Nice one Joe

    With a little tweaking I have this working now

    I have created two files for this jezza.bat and jezza.vbs (original eh? <img src=/S/grin.gif border=0 alt=grin width=15 height=15>)

    Both placed on the root


    jezza.vbs
    <pre>Dim Catalogue 'As COMAdminCatalog

    Set Catalogue = CreateObject("ComAdmin.COMAdminCatalog")

    Call Catalogue.ShutdownApplication ("COM+Name")

    Set Catalogue = Nothing</pre>


    jezza.bat

    <pre>net stop "w3svc"

    Cscript c:jezza.vbs

    net start "w3svc"</pre>


    Works a treat
    Jerry

  16. #15
    Administrator
    Join Date
    Mar 2001
    Location
    St Louis, Missouri, USA
    Posts
    20,376
    Thanks
    1
    Thanked 595 Times in 532 Posts

    Re: Component Services Stop

    Terrific!! Glad you got it working. Nothing like stumbling on something useful once in a while. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    Joe

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •