Users

All Posts (35)

avatar

bparappilly

Unable to save a user via powershell

avatar
avatar
avatar
avatar

The following script is used to create a user:

$securePassword = ConvertTo-SecureString "xxxxxxxx" -AsPlainText -Force
$newUser = New-RDMUser -Login $name -AuthentificationType "AzureAD" -Email $email
$newUser.FirstName = $fname
$newUser.LastName = $lname
$newUser.LoginEmail = $email
$newUser.UserInfo.UserAccount.TwoFactorInfo = New-Object 'Devolutions.RemoteDesktopManager.Business.TwoFactorInfo' -Property @{AuthenticationType=[Devolutions.RemoteDesktopManager.TwoFactorAuthenticationType]::GoogleAuthenticator; IsPreConfigured=$true}
$newUser.UserType = [Devolutions.RemoteDesktopManager.UserType]::User
Set-RDMUser -User $newUser

Unable to save a user via powershell

avatar
avatar
avatar
avatar

I have the data source set correctly. In fact, I have the same line that you suggested in the other ticket added to the beginning of the script:

Unable to save a user via powershell

avatar
avatar
avatar
avatar

I use powershell scripts to sync users from internal system into RDM. But after a recent upgrade of the server, I get the following error when trying to save a user:

Can you help?

Powershell module automation not working from .NET application.

avatar
avatar
avatar

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.

Powershell module automation not working from .NET application.

avatar
avatar
avatar

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.

Powershell module automation not working from .NET application.

avatar
avatar
avatar

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.

Powershell module automation not working from .NET application.

avatar
avatar
avatar

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.

Powershell module automation not working from .NET application.

avatar
avatar
avatar

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?

Powershell module automation not working from .NET application.

avatar
avatar
avatar

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.

Powershell module automation not working from .NET application.

avatar
avatar
avatar

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

Powershell module automation not working from .NET application.

avatar
avatar
avatar

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

Powershell module automation not working from .NET application.

avatar
avatar
avatar

if there is a way I can show it over a screencast, please let me know how.

Powershell module automation not working from .NET application.

avatar
avatar
avatar

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

Powershell module automation not working from .NET application.

avatar
avatar
avatar

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+)

Powershell module automation not working from .NET application.

avatar
avatar
avatar

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

Powershell module automation not working from .NET application.

avatar
avatar
avatar

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

Powershell module automation not working from .NET application.

avatar
avatar
avatar

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?

Retrieve users based on condition

avatar
avatar
avatar
avatar
avatar

Hi Alex,

Let me explain what I was trying to achieve. It may help you suggest a better solution. I have a .NET app that needs to create/modify/delete RDM entities (session, user, permission, etc.). I had two choices to run it either with an always on powershell session with RDM or a new session each time I try to sync entities. The always on session works fine for some time (random time, sometimes as long as a day and sometimes as low as a hour) and then it stops working (requires kill and start a new one). One of the requirements I had is to modify an entity based on its value in one of the custom fields (CustomField1Title). The sync should happen in the least possible amount of time. So, if I had to start a new powershell session for each invocation, fetching all entities takes about 10 seconds, which is not allowed. Hope you may have a better option to handle this situation.

Best regards

Retrieve users based on condition

avatar
avatar
avatar
avatar
avatar

Hi Alex,

While this does what is required, it involves significant time to fetch the data initally. So, if I rephrase, I was looking for an option to filter it while fetching from the database and not requiring to load the entire data set.

Retrieve users based on condition

avatar
avatar
avatar
avatar
avatar

Hello Support,

I am required to get users or sessions filtered by property values other than Name. Currently, I do not see an option using the regular Get-RDMUser/Session commands. Is there any way to do it?

Get-RDMUser throws error on a freshly installed system

avatar
avatar
avatar
avatar

It worked, thank you!

Could you advise how to make it default? or is it a new change in this version?

Update: I fixed it by deleting the Local Data Source (default)

You can close the ticket.

Get-RDMUser throws error on a freshly installed system

avatar
avatar
avatar
avatar

The version is 2020.2.18.0 64 bit. And, it works through the Tools>Powershell inside RDM.

Kind regards

Get-RDMUser throws error on a freshly installed system

avatar
avatar
avatar
avatar

I am testing out the RDM password server and installed a trial version on my local machine. It's working good as I can see from the web based as well as WinForms based applications. But my original need is to work with Powershell scripting. When I issue the powershell command, say, Get-RDMUser, it throws the following exception:

PS C:\Windows\System32\WindowsPowerShell\v1.0> get-rdmuser

Get-RDMUser : Cannot retrieve the dynamic parameters for the cmdlet. Cannot process argument because the value of argum

ent "validValues" is out of range. Change argument "validValues" to a value that is within range.

Parameter name: validValues

Actual value was System.String[].

At line:1 char:1

+ get-rdmuser

+ ~~~~~~~~~~~

+ CategoryInfo : InvalidArgument: (:) [Get-RDMUser], ParameterBindingException

+ FullyQualifiedErrorId : GetDynamicParametersException,RemoteDesktopManager.PowerShellModule.GetRDMUserCommand

Can you help?

Stale powershell session

avatar
avatar
avatar

Hello, I have tried your suggestion and it has no impact. The commands will not work after some time.

Stale powershell session

avatar
avatar
avatar

RDM version is 'Enterprise Edition 2020.1.10.0'.

'It stops communicating...' where it means the powershell host, and the destination is Devolutions Password Server and the DPS version is 2019.2.12.0

The service I am restarting is a Windows service that hosts a powershell instance.

1 - 25 of 35 items