Reputation: 1969
I need an efficient way to execute the Microsoft Diagnostic Tool Troubleshooting Pack via C# on a remote machine.
The criteria for the Troubleshooter is:
I have found a few ways to do it via Powershell, however without successfully getting it to work.
If run with Powershell I need it to run with credentials from the user running the C# application, or at least being prompted for credentials.
I have managed to run the troubleshooter via msdt.exe
and cmd through WMI. However, it does not complete and all I see is the process running in task manager.
The Troubleshooter pack I am trying to execute is AERO.
The target operating system is Windows 7, and it is on a domain network.
Upvotes: 1
Views: 678
Reputation: 18747
You can create a task in Task Scheduler on the remote machine, specifying the executable with parameters, and you can specify both credentials and "Run with highest privileges (elevated)" flag. You can use the Powershell script that launches Aero troubleshooting pack as an unattended task with log collection. Then, you allow manual starting of this task, and then, once the need arises, you can execute a start of a scheduled task via schtasks.exe /run
. This way the unattendedness is achieved via Powershell script like here (Windows 7 Resource Kit book), credentials and elevated run are provided by Task Scheduler engine. The script in question is as follows:
Import-Module TroubleshootingPack
$aero=Get-TroubleshootingPack $env:systemroot\diagnostics\system\aero
Invoke-TroubleshootingPack -pack $aero -result "c:\temp" -unattend
Upvotes: 3