Powershell Automation remove instance from monitoring

by Mar 2, 2021


I am trying to prepare a script to automate instance management to add and remove servers to SQLDM monitoring. I was able to add instance to SQLDB with "New-SQLdmMonitoredInstance", but the issue is with remove instance from SQLDM.I couldn't able to remove instances from SQLDB, getting following error,

Remove-SQLdmMonitoredInstance : Cannot find path 'dm:Instances10000-TEWADYX' because it does not exist.

The command I am using to remove instance is, 

          Remove-SQLdmMonitoredInstance -Path Instances10000-TEWADYX

Some help would be greatly appreciated.