Results 1 to 4 of 4

Thread: xp_cmdshell

  1. #1
    Join Date
    Dec 2003
    Location
    Delhi INDIA
    Posts
    58

    Unanswered: xp_cmdshell

    I need to kill some user session that i get from below query output

    xp_cmdshell 'netstat -an | find /i "est"'

    output: -

    TCP 0.0.0.47:1099 0.0.0.39:139 ESTABLISHED
    TCP 0.0.0.47:1433 0.0.0.104:2961 ESTABLISHED
    TCP 0.0.0.47:1433 0.0.0.104:3012 ESTABLISHED
    TCP 0.0.0.47:1433 0.0.0.39:2915 ESTABLISHED
    TCP 0.0.0.47:1433 0.0.0.39:3106 ESTABLISHED
    TCP 0.0.0.47:2007 0.0.0.26:1487 ESTABLISHED
    TCP 0.0.0.47:2007 0.0.0.79:1139 ESTABLISHED

    do we have any command to kill the connected session to my sql except kill spid.

    ex: i want to kill the session of IP 0.0.0.79 from my sql server.

    thanks in advance
    Deep..

    MCDBA
    ------------------------------------------
    How much data you can afford to lose??

  2. #2
    Join Date
    Dec 2003
    Location
    Delhi INDIA
    Posts
    58
    reloading the question for you!! pls help
    Deep..

    MCDBA
    ------------------------------------------
    How much data you can afford to lose??

  3. #3
    Join Date
    Feb 2004
    Posts
    492
    Using xp_cmdshell you could consider executing the following commands:

    net stop SQLSERVERAGENT
    net stop MSSQLSERVER

    but dont forget to fire 'em up again.

  4. #4
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    Originally posted by Kaiowas
    Using xp_cmdshell you could consider executing the following commands:

    net stop SQLSERVERAGENT
    net stop MSSQLSERVER

    but dont forget to fire 'em up again.
    Stopping the service?????

    You can use "net session" with your xp_cmdshell to load the result into a temp table, and then "net session \\" + computer_name + " /DELETE" to disconnect it.

    Something like this:

    net session | find /i "\\"
    Last edited by rdjabarov; 04-01-04 at 14:20.

Posting Permissions

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