Hi,
You could use Invoke-AsCmd with Powershell to capture the log and other desired event.
Take reference to this ServerMode: Tabular part code in blog : PowerShell Scripts for Collecting SSAS-related Perfmon and xEvent Trace Data
See if it is what you needed.
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
What can I do if my transaction log is full?--- Hot issues November
How to convert Profiler trace into a SQL Server table -- Hot issues November