We used to work with the RDM powershell module inside a dotnet application via .NET automation API of powershell. It was all good until we upgraded to 2.20 and then it stopped working. When I run it from a normal powershell, it is working. But when it is run from the automation, the connection is not available. Can you help?
Hi,
I don't think we've ever tried that scenario, at least since the switch to the new module.
I'm gonna have test our module with the automation API. The new module targets .net standard in order to be compatible with both PS5.1 (.net 4.6) and PS7 (.net6). That brought its lot of problems and it's possible the automation API is getting around some of our solutions.
I'll let you know what I find.
Regards
Jonathan Lafontaine
Is the .net application targeting .net 4.x or .net core?
And when you mention "normal PowerShell" are you referring to PS5.1 or PS7?
Jonathan Lafontaine
Is the .net application targeting .net 4.x or .net core?
And when you mention "normal PowerShell" are you referring to PS5.1 or PS7?
I meant PS5.1
.Net is targeting 4.8
Hi,
I don't think we've ever tried that scenario, at least since the switch to the new module.
I'm gonna have test our module with the automation API. The new module targets .net standard in order to be compatible with both PS5.1 (.net 4.6) and PS7 (.net6). That brought its lot of problems and it's possible the automation API is getting around some of our solutions.
I'll let you know what I find.
Regards
where the script is what the custom script that uses RemoteDesktopManager module
Hi,
I don't think we've ever tried that scenario, at least since the switch to the new module.
I'm gonna have test our module with the automation API. The new module targets .net standard in order to be compatible with both PS5.1 (.net 4.6) and PS7 (.net6). That brought its lot of problems and it's possible the automation API is getting around some of our solutions.
I'll let you know what I find.
Regards
Inside my script Get-RDMSession returns 0 items while in normal PS, it gives all the sessions. (3k+)
My first guess would be that either the module inside your application isn't loading the same RemoteDesktopManager.cfg, which will probably result with the creation of a brand new and empty sqlite data source or you configuration is loaded but the module isn't able to connect to your data source.
If you can log command results from your application, does Get-RDMInstance and Get-RDMCurrentDataSource return the same output inside your application vs in a PS terminal?
Jonathan Lafontaine
I print the module version and it is 2.3 as in your powershell gallery nuget package version.
get rdm instance gives the correct version of the module that I installed from gallery (the latest)
get-rdmcurrentdatasource is empty
Get-RDMCurrentDataSource should have returned your configured data source name, connection state, offline state and data source type.
I'll create a demo based on the code you provided and see what I can reproduce on my end.
Jonathan Lafontaine
if there is a way I can show it over a screencast, please let me know how.
Get-RDMCurrentDataSource should have returned your configured data source name, connection state, offline state and data source type.
I'll create a demo based on the code you provided and see what I can reproduce on my end.
Get-rdmdatasources returns two data sources, and both are are IsConnected false inside the .net application and IsConnected True in my local powershell session
Oh. So for some reasons, your data source isn't connecting when running inside your dotnet app.
What data source are your connecting to and using what authentication method?
Jonathan Lafontaine
Oh. So for some reasons, your data source isn't connecting when running inside your dotnet app.
What data source are your connecting to and using what authentication method?'
the data source is sql server, authentication method is devolutions server username/password
Oh. So for some reasons, your data source isn't connecting when running inside your dotnet app.
What data source are your connecting to and using what authentication method?
In the following, the highlighted one is the connection I should have in the dotnet app:
as you see, IsConnected: True, the type is RDMS. Inside dotnet, IsConnected is false
and I use a set of username and password to login.
Oh. So for some reasons, your data source isn't connecting when running inside your dotnet app.
What data source are your connecting to and using what authentication method?
Could you also let me know what is the preferred way of a .NET app interacting with the RDM. Last time I checked, powershell was the only way. Is there any change to it? Even when using powershell, is the automation API of .NET the way to go about?
I've made a real basic C# program that loads the PowerShell module and loads a data source.
Everything works like it does when executing directly in PowerShell.
Would you be able to compile and run the same program to compare our results?
Jonathan Lafontaine
I've made a real basic C# program that loads the PowerShell module and loads a data source.
Everything works like it does when executing directly in PowerShell.
Would you be able to compile and run the same program to compare our results?
Yes, I can test it. But could you help me with the source code.
I'll send you the whole project in a private message.
Jonathan Lafontaine
I'll send you the whole project in a private message.
I got it, thank you. Your code works as intended. But, my process is started from a windows service and it still does not get the connection. What I see is when running that process locally by directly invoking, the authentication pop up shows up frequently. This pop up is obviously missing in the process that was started by windows service. So I guess it is the reason why connection is invalid in the process started from windows service. Earlier, we just had to sign in one powershell window and the same windows user is automatically signed in any other powershell window he opens. but now every new powershell window requires a sign in. We are stuck on these two issues currently.
To prevent authentication from prompting, you could add an app id/password to your RDMS data source.
You existing authentication method will coexist with the app password. RDM will use whatever authentication process you had configured and PowerShell will use the app password.
In RDM, you can add the app the app id/password in the PowerShell tab while editing your RDMS data source.
To obtain the id and password, go to your DVLS instance web site and select Applications from the Administration menu.
Don't forget to give the application access to the required vaults and to assign a role while in the new application window.
Let me know if this solve your issue.
Jonathan Lafontaine
To prevent authentication from prompting, you could add an app id/password to your RDMS data source.
You existing authentication method will coexist with the app password. RDM will use whatever authentication process you had configured and PowerShell will use the app password.
In RDM, you can add the app the app id/password in the PowerShell tab while editing your RDMS data source.
To obtain the id and password, go to your DVLS instance web site and select Applications from the Administration menu.
Don't forget to give the application access to the required vaults and to assign a role while in the new application window.
Let me know if this solve your issue.
I tried, but it still behaves the same way, when run from windows service, the error is: Connection not found.
In your DVLS logs, do you see the attempt login from the app id?
Jonathan Lafontaine
In your DVLS logs, do you see the attempt login from the app id?
It seems to work fine now, the tenant id and secret was not saved in the first two attempts, but now when i tried again, it is ok, and I dont get the error from win service powershell command and I see the data fine.
thanks for the support.
I'm glad we were able to figure out and fix your issue.
Don't hesitate to reach back for any other problem.
Jonathan Lafontaine