Anyone who has ever called Microsoft’s CSS team for support for a SQL Server has probably been told to run pssdiag against the server while reproducing the issue, or for some period of time. To run pssdiag we just run pssdiag.cmd and let it do it’s thing, then press +C to stop it. But there’s actually a few command line options which are available which can make using pssdiag a bit easier.
/Q – Delete the data from the output folder before running.
/E – Stop pssdiag after n minutes or at n time. If you want to run it for 10 minutes for example use “/E +00:10:00″. If you want to stop it at 10pm use “/E 22:00:00″.
/B – Start pssdiag capture after n minutes or at n time. If you want to start it in 10 minutes for example use “/B +00:10:00″. If you want to start it at 10pm use “/B 22:00:00″.
/O – write the output to a different folder. Such as “/O T:pssdiagoutput”.
/N – Weather you should use the same folder everytime pssdiag runs, or keep all the captures. Using “/N 1″ always using the same folder. Using “/N 2″ appends a number to the end of the folder so that you can run the capture over and over and keep your results each time.
/M – Specifies the machine to run pssdiag against if you want to run it remotely using “/M ServerName Server2 Server3″
/C – To use compression or not on the files. “/C 1″ uses no compression (this is the default). “/C 2″ uses NTFS compression. “/C 3″ uses CAB file compression.
If you need to make pssdiag a little more automated so that you can capture overnight issues this should present you with some really good options.