Powershell Automation remove instance from monitoring

Hello,

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:\Instances\10000-TEWADYX' because it does not exist.

The command I am using to remove instance is, 

          Remove-SQLdmMonitoredInstance -Path \Instances\10000-TEWADYX

Some help would be greatly appreciated.

Parents
  • Below is a screenshot example of me using the command. Notice that there is an error generated in my example as well. The error is because the SQLdmRepository database is case-sensitive and the names didn't match. Once I corrected the casing to match what's in the repository database, then the command worked as expected. 

    I know that the cmdlet has an option to use the -Path parameter to specify the name of the monitored instance. However, PATH doesn't work with named instances. As such, I typically always use the Escape-SQLdm method since it works with both named instances and default instances. 


    I hope that helps.

Reply Children