MSSQL Server

MSSQL Query Session Information

Get info on non-sleeping sessions or open open transactions.

SELECT DB_NAME(database_id) AS dbname, *
FROM sys.dm_exec_sessions WHERE 1=1
AND is_user_process > 0
AND ( open_transaction_count > 0 OR status <> 'sleeping' )
ORDER BY database_id

GNU/Linux WGET Auth

With the wget example below, you can download a file when HTTP auth is required.

wget --http-user=<username> --http-password=<password> --ca-certificate='chain1.pem' '' -O file.bin

Form-based authenticatie wget example using a session cookie…

wget --post-data='UserName=<username>&Password=<password>' --ca-certificate='chain2.pem' --cookies=on --keep-session-cookies --save-cookies=cookie.txt '' -O result.txt

wget --referer='' --ca-certificate='chain2.pem' --cookies=on --keep-session-cookies --load-cookies=cookie.txt '' -O file.bin
MSSQL Server

MSSQL Search Blocked Sessions

Query for blocked sessions.

SELECT session_id, status, blocking_session_id FROM sys.dm_exec_requests WHERE blocking_session_id > 0

Close a blocking session.

KILL {blocking_session_id}