• I fully agree with all of the above.  cmd scripts, or batch files if you are 'old' school, still can be enormously useful.

    Here's a tip I use from time to time if you cannot connect to a SQL server and you don't have TS Administrator handy.

    Killing a TS Session via Query Analyser

    Occasionally all the available connections will be used up. If you have Terminal Services Manager loaded you can easily close down a connection. If you don't (the case on my XP machine at home), Brian Knight pointed out a very nice trick you can use if it's a SQL box. To get all the active sessions, open Query Analyzer and run this:

    master..XP_CMDSHELL 'QUERY SESSION'

    -- You'll get back a resultset containing sessionname, username, id, and state. Pick the sessin ID of the connection you want to kill, then run this:

    master..XP_CMDSHELL 'logoff sessionid'

    If you get back a single row containing null, it worked and you should be able to get a connection.

    Dave Jackson


    http://glossopian.co.uk/
    "I don't know what I don't know."