Forum Discussion
Mike_Elliott
Nov 17, 2020Copper Contributor
Microsoft Monitoring Agent - powershell script problem
Morning all. I've created a short script to help me modify the configuration of Microsoft Monitoring Agent installed on some servers. The script seems to work well with one exception (pardon the pun). If I run with an '-action remove' switch, supplying a workspaceID argument value, it successfully removes a workspaceID from the agent config but I get a timeout waiting for the response as shown below.
Any ideas on why I get the exception and how I can code for it? And of course keen to hear any views on how the script can be improved. Be gentle.
** update - I've created a GitHub repos to host the script https://github.com/mikeelliottuk/MMAagentscript Raw script content here https://raw.githubusercontent.com/mikeelliottuk/MMAagentscript/main/MMA_modify_workspace.ps1
console output....
PS C:\test> .\MMA_modify_workspace.ps1 -action remove 3109a0e6-520f-4da5-9c0e-xxxxxxxxxxxx
The wait operation timed out. (Exception from HRESULT: 0x80070102)
At C:\test\MMA_modify_workspace.ps1:43 char:5
+ $mma.ReloadConfiguration()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped:
) [], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
Workspace 3109a0e6-520f-4da5-9c0e-xxxxxxxxxxxx removed.
5 Replies
- Thijs LecomteBronze ContributorJust wanted to confirm that I use the same commands...
Are you having this on multiple agents? Wat version are you using- Mike_ElliottCopper Contributor
Thijs Lecomte Thanks for getting back. So it seems so far to be confined to a couple of hosts, both of these are VMs on VMWare workstation. I've only tested on a few servers though so not a big sample so far. Servers are 2019, MMA agent is 10.20.18053.0 so the latest I beleive.
The issue only occurs when I attempt to remove a workspaceID. In my tests the workspace ID I'm removing is the last one on the agent.
- Thijs LecomteBronze ContributorAhn that is possible.
I have a script that checks if it's the last workspace, it just removes the workspaces. Is this something you could implement?
I can share it if you want