# ==================================================================================================== # # NAME: MonitorBlockings.ps1 # # AUTHOR: Yan Pan # DATE : 10/21/2007 # # COMMENT: This script collects blocked process reports. # You can specify the threshold at which blocked process reports are generated # with the "blocked process threshold" option on the SQL Server. # ===================================================================================================== $query = "SELECT * FROM BLOCKED_PROCESS_REPORT" $sqlnamespace = "root\Microsoft\SqlServer\ServerEvents\MSSQLSERVER" $selections= "LoginSid","PostTime","SQLInstance","IsSystem","DatabaseID","ComputerName", ` "SessionLoginName","SPID","TransactionID","EventSequence","IndexID","ObjectID","TextData", ` "EndTime","Duration","Mode" Get-WMIEvent $query $sqlnamespace $selections