At this time there are no PowerShell commands for the management of perfmon. PowerShell does have three commands for accessing perfmon counters: get-counter, export-counter, import-counter.
For this reason we will still need to use the old Logman.exe command to manipulate perfmon.
Seeing a list of defined data collectors
This command will list all of the data collector sets on the targeted server.
Viewing details on a single data collector set
In order to view details on a single data collect set you must know the exact spelling. If there is a space in the name you must place quotes around the name.
Logman query LogmanCapture
Creating a Data Collector Set
There are several ways to create a collector set. The example below was selected because it can simply be copied and pasted without requiring any additional files. This command will collect the necessary objects needed to do a quick performance analysis. To analyze this output you will need to move the blg file off of the core box onto a workstation with a GUI. You can use Perfmon which ships with the OS to review the data manually or PAL (found at: http://pal.codeplex.com/) which is a PowerShell script that can analyze the blg file based on Microsoft’s recommended thresholds.
Logman create counter LogmanCapture -v mmddhhmm -c “\LogicalDisk(*)\*” “\Memory\*” “\Netlogon(*)\*” “\Paging file(*)\*” “\PhysicalDisk(*)\*” “\Process(*)\*” “\Processor(*)\*” “\System\*” -si 00:00:30 -f bincirc -o “c:\Perflogs\LogmanCapture_%computername%” -max 250
Starting the Data Collector Set
Logman start logmancapture
Notice in the output below the data collector is orignially in the stopped state. After the command has been run it is in the running state.
Stopping the Data Collector Set
Logman stop logmancapture
Notice the data collector below has gone from the running state to the stopped state.
I hope you found this useful. Please leave me a comment. Let me know if there are any core tasks you would like me to cover.