Hi,
I'm trying to make a script, there's connecting to an RDM-database hosted on a Microsoft SQL-server, without I have to set up the connection first in the UI.
My problem is that it's never getting connected to the RDM-database.
Simplified script:
$rdmdataSourceNew = New-RDMDataSource -Name "RDM" -Database "RemoteDesktopManager" -SQLServer -Server "<internal dns-address>" -IntegratedSecurity -SetDatasource Set-RDMDataSource -DataSource $rdmdataSourceNew
When I'm afterwards are trying to get the datasource with Get-RDMDatasource - I'm getting the following output:
ID : <a GUID> IsConnected : False IsOffline : False Name : RDM Type : SQLServer
So it will not connect to the datasource.
I'm using Powershell module version: 2022.2.0.0
Br,
Anders
Hi Anders,
SQL Server is an advanced data source, meaning it requires the enterprise version of RDM.
If you are not using RDM (or using a different cfg file), no license has been entered and PowerShell is operating in Free mode.
You can validate your license info with either Get-RDMRegistrationInfo or Get-RDMDiagnostic command.
If the problem is indeed the license, you can manually register your license like this
$reg = Get-RDMRegistrationInfo $reg.Name = "Licensee name" $reg.Email = "Licensee email" $reg.Serial = "License serial" Set-RDMRegistrationInfo $reg
If your license is managed by your data source, you can register doing this instead.
Register-RDMFromDataSource $rdmdataSourceNew
Let me know if this solves your issue.
Regards
Jonathan Lafontaine
Hi Jonathan,
It was a license-related problem - that wasn't clear. :)
Now is my problem, that I can't pass a "Yes" to the command Register-RDMFromDataSource when I'm trying to run the command in the script.
The command doesn't accept '-Force' or '-Confirm:$true', and I can't open a Powershell in the same context as the script is running.
Any suggestion? :)
Br,
Anders
If your script is meant to be run on a single machine, the data source and license should save to the cfg file and could be reused.
In that case, you won't have to register your license again.
However, if you plan on deploying this script on multiple target system, that won't help.
In that case, I'll see what I can do.
Jonathan Lafontaine
It wasn't the plan to deploy it to multiple machines - at least not this script, but maybe there may come other in the future, so it would be nice to be able to "force" it to register.
I tried to copy the file "RemoteDesktopManager.cfg" from one user on the machine, to the other users "\AppData\Roaming\Devolutions\RemoteDesktopManager", but that just gave an error.
Get-RDMCurrentRepository : Object reference not set to an instance of an object.
and
Get-RDMSession : Connection not found.
Should I edit something in the cfg file, when copying it between profiles?
//Anders
Just copying the cfg file is not enough, unfortunately.
You will also have to copy RemoteDesktopManager.enc, RemoteDesktopManager.ext and RemoteDesktopManager.stv
And I'll see what I can do about that prompt.
Jonathan Lafontaine
When copying file 4 files, I'm getting the following error:
NullReferenceException - Object reference not set to an instance of an object. at Microsoft.PowerShell.ConsoleHostUserInterface.PromptForChoice(String caption, String message, Collection`1 choices, Int32 defaultChoice) at System.Management.Automation.Internal.Host.InternalHostUserInterface.PromptForChoice(String caption, String message, Collection`1 choices, Int32 defaultChoice) at Devolutions.RemoteDesktopManager.Managers.UIManager.ShowConfirmationMessage(String message, Boolean defaultYesButton) at Devolutions.RemoteDesktopManager.Business.DataSources.DatabaseUpdater.Upgrade(Boolean silent, Action`1 logMessage) at Devolutions.RemoteDesktopManager.Managers.ConnectionManager.LoadConnectionsFromDataSource(ConnectionEngine engine, Boolean hasChanged) at Devolutions.RemoteDesktopManager.Managers.ConnectionManager.LoadConnections(BaseConnectionDataSource dataSource) NullReferenceException - Object reference not set to an instance of an object. at Microsoft.PowerShell.ConsoleHostUserInterface.PromptForChoice(String caption, String message, Collection`1 choices, Int32 defaultChoice) at System.Management.Automation.Internal.Host.InternalHostUserInterface.PromptForChoice(String caption, String message, Collection`1 choices, Int32 defaultChoice) at Devolutions.RemoteDesktopManager.Managers.UIManager.ShowConfirmationMessage(String message, Boolean defaultYesButton) at Devolutions.RemoteDesktopManager.Business.DataSources.DatabaseUpdater.Upgrade(Boolean silent, Action`1 logMessage) at Devolutions.RemoteDesktopManager.Managers.ConnectionManager.LoadConnectionsFromDataSource(ConnectionEngine engine, Boolean hasChanged) at Devolutions.RemoteDesktopManager.Managers.ConnectionManager.LoadConnections(BaseConnectionDataSource dataSource) NullReferenceException - Object reference not set to an instance of an object. at Microsoft.PowerShell.ConsoleHostUserInterface.PromptForChoice(String caption, String message, Collection`1 choices, Int32 defaultChoice) at System.Manag
Is your RDM set to a language other than English by any chance?
Jonathan Lafontaine
There isn't a RDM UI installed on the server, where I'm trying to run the script on.
I'm able to my script on the same server, but in another user-context. So I can run the script on that particular server.
The server is a Windows Server 2019 with English UI/language.
The 4 copied files are coming from a session using RDM?
Jonathan Lafontaine
I have tried both from another session on the same server without UI, but also from my session on another server, where the RDM UI is installed.
The reason why I'm asking is that crash seems to point to a resources that has not been translated. There's no much else that can trigger a NullReferenceException in that function.
But back to your first issue.
If you do not try to copy the cfg file and use PowerShell without RDM at all, do you have to recreate your data source every single time?
If so, that's not the intended behaviour and will need a fix. And checking for a -Force option for Register-RDMFromDataSource.
Jonathan Lafontaine
It is remembering the datasource-config, when I have created it. I can see the files in the appdata-folder.
An small update. I was able to register RDM in the right context, after some "cheating"... :)
So as of now, my problem is solved, but I still think the option to silently register with Register-RDMFromDataSource should be available.
Glad it now works.
Yes, this is something we will consider adding.
Jonathan Lafontaine
Hi,
Do you happen to remember what message was being prompted you couldn't bypass when calling Register-RDMFromDataSource?
I just want to make sure I haven't missed yours.
Jonathan Lafontaine