Thursday 29 January 2015

PowerShell script for starting AX Perfmon event trace remotely

In my previous post I talked about starting AX Perfmon trace remotely. Attached to this post is the PowerShell script that does the same. The stop step also copies the trace generated to a network folder. Instead of starting the script in PowerShell and specifying parameters, I have created a shortcut for each operation on an AOS server. So from a remote machine, trace can be generated and can be loaded from the network folder for analysis.

The script folder have following files
StartStopTrace.ps1: This is where the actual PoweShell code resides.

Parameters.txt: Parameters file to specify the data collector set name, destination folder to copy trace and the source path of trace as shown below 
AXTraceTemplate.xml: This is the template to create data collector set on new AOS servers. This already have the recommendations suggested in original MS blog.

AOS 1 Start Trace shortcut: Use to start trace on AOS 1. The value of "Target" property of the short cut contains
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File .\StartStopTrace.ps1  -Operation Start -Server AXPROD-AO1
AOS 1 Stop Trace shortcut: This is similar to start shortcut except the operation is stop.

More shortcuts can be created for additional AOS as required.

This posting is provided "AS IS" with no warranties. Use code at your own risk.

No comments:

Post a Comment