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.
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.
Tep,
Thank you for your prompt response. I tried with Escape-SQLdm and still getting same error. In this case I don't have named instances and I using same case that I see on dashborad. BUt some reason I don't see this instance under "MonitoredSQLServers" DB table. I am new to Idera, and I am not sure how DB supposed to register it in DB
PS dm:\> Remove-SQLdmMonitoredInstance -Path (Escape-SQLdmName -Name 10000-TEWADY)Remove-SQLdmMonitoredInstance : Cannot find path 'dm:\Instances\10000-TEWADY' because it does not exist.At line:1 char:1
Try removing the "-Path" from the line. Notice that in my example, it doesn't include -PATH.
Remove-SQLdmMonitoredInstance (Escape-SQLdmName -Name 10000-TEWADY)
However, if you don't see it in the MonitoredSQLServers table, I'm not sure you'll be able to do that. Can you share screenshot of your dashboard showing the instance name?
even without "-Path", command returning same error.
Sorry, I couldn't provide our real instance name and the screenshot. The instance name provided above was not real as well. However I made sure that the correct instance is added to dashboard and it is not available in DB table. I added this new instance to SQLDM couple of hours back, is ther eany grace period to register in DB?
Following are the command I used to add a instance to SQLDM,
add-pssnapin sqldmsnapinNew-SQLdmDrive dm <IDERAServer> SQLdmRepositorycd dm New-SQLdmMonitoredInstance -Path 10000-TEWADY -WindowsAuthentication -tags UATInstances
Then the only thing that I can think of at this point would be that perhaps you need to enclose the server name? I'm wondering if maybe the - character is being misinterpreted. But if you don't see the server name in the MonitoredSQLServers table, that's going to be the bigger problem.
The image above shows you the different places you can see the instance name. I've also included the Monitored SQL Servers Properties window (shown on the right side of the image) which shows you both the name registered in the tool as well as the friendly name (towards the middle of the properties windows).
In the servers list (on the left side), you can also see the friendly name "ABC" and the registered instance name in parenthesis (KIBA\SQL2017). To use the cmdlet, you need the registered instance name and not the friendly name.
SELECT InstanceName,FriendlyServerName FROM MonitoredSQLServersUnfortunately, without seeing what's registered, I'm not sure I can offer any other suggestions.
Please excuse me, I actually see the Instance in DB. Execute wrong query earlier. Let me try quotes now.
I have tried with quotes that didn't help. So, I have added new test instance with IP this time and still seeing same issue. is there any cmdlets that would allow me to list the all instances on PS terminal?
Here are the screenshots of registered server on SQLDM and Error I am getting
under SQLDM drive Get-ChildItem returning this,
Sorry ajbe but I'm not sure why it's not working for you. Given that "Instances" is completely blank, I'm wondering if your connection is able to successfully connect to the SQLdm repository database.I did notice that your screenshot is different from mine. It appears that you are running an older version of SQLDM. Perhaps there was a bug in that version (although I don't recall there ever being a bug in this area).
I have been trying to execute these add and remove instance command from remote server. When executed Add instance cmdlet, it worked and I see the instance on dashboard and DB, so it tells me it successfully connecting SQLdm. whereas executing remove instance command, it is not working and not listing instances.
So I have tried the same remove cmd directly on server where Idera is running, it listed the instances and also was able to remove the server. It tells me remove instance cmd is not working from remote server.
Do you know what blocking remove cmd from remote server or this is how Idera works?
I went and tested using the snapin from a remote server and I was able to use it successfully.
My best guess at this point is that perhaps application security in SQLDM (if enable) might be doing something odd in your environment. If you can add, you should be able to remove. If you can't add, then you also shouldn't able to remove.
Out of curiosity, are you logged into windows under the same user account on both the remote server and the SQLDM server? Does the Get-ChildItem show you the same results on both?It might be a good idea to open a support case to dig into this further as it seems like there might be something in your environment that's causing these oddities.
Yes, I am using same windows account on both the servers. For Get-ChilItem, Instances is blank on remote server, whereas on DQLDM it printed the instances. Problem is only from remote server.
I will check on security options. But I was able add instance from remote server.
Hi Tep,
As you mentioned earlier, the issue seems with the SQLDM desktop client version that I installed on remote server. The SQLDM version running is 10.0.2. Unfortunately we no longer have client file "SQLDiagnosticManager-x64_c.exe" with same version in Installation kit. Due to this, Client even not able to connect to SQLDM and throwing following error. Not sure why add command worked but not remove command.
Do you know where can I find Client installer v10.0? or way to downgrade?
Thank you for your help all along.
ajbre,
unfortunately, I do not know where you could find an older version of the installer. If you have current maintenance with IDERA, you can check with them to see if they can provide it to you. However, given that it appears to be out of support, I'm not sure that they would be able to provide it to you.