PowerTip: Enable and disable ODBC performance counter settings with PowerShell

Doctor Scripto

Dr Scripto

Summary: Learn how to enable and disable a collection of ODBC performance counter settings for troubleshooting.

Hey, Scripting Guy! Question How can I use Windows PowerShell to enable the ODBC performance counters, run commands in a script, and then disable the counters?

Hey, Scripting Guy! Answer You can store a returned object for later use when you enable the performance counters by using the -PassThru parameter, for example:

$perfCounter = Enable-OdbcPerfCounter -Platform 32-bit -PassThru
<Execute some ODBC applications that are using ODBC pooling>
Disable-OdbcPerfCounter $perfCounter

Doctor Scripto
Dr Scripto

Scripter, PowerShell, vbScript, BAT, CMD

Follow Dr Scripto   


    Leave a comment