PowerShell module no longer works
I went back to try that command and I started getting db out of date warnings, so I rolled the module back to be more in line with the RDM version we're at. Everything worked afterwards.
I then changed Set-RDMSession with Set-RDMEntry and it's all still working.
Thanks for the help,
Chris
PowerShell module no longer works
I'm not sure what is going on, but the `Set-RDMSession` cmdlet no longer works.
```
IsConnected : True
IsOffline : False
Name : Customers
Type : SQLServer
VERBOSE: [Set-RDMSession] Start
Set-RDMSession: Z:\SCRIPTS\powershell\Create-RDMCredential.ps1:77
Line |
77 | Set-RDMSession $cr -Refresh -Verbose
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Your connection is not ready
VERBOSE: [Set-RDMSession] Finish
```
I've rebooted the server multiple times, updated RDM, and updated the powershell module with the same result. It's not a permission problem as every other command works and I can do everything manually in RDM itself.
Is there any way to figure out why this isn't working? Everything looks like it should work.
Thanks,
Chris
PS Auth Changes?
Hello Chris,
I don’t recall any recent changes to the authentication process. To help troubleshoot the issue, I’ll try to reproduce the error.
To proceed, could you please provide the following details?
What type of data source are you using (e.g., Devolutions Server), and what is its version?
Are you using an application to connect?
Best regards,
Maxime
It looks like as soon as I update the module to 2024.3.2, I start getting problems. Version 2024.2.7 is fine.
I'm assuming either the PAM rewrite changed some requirement or maybe " Add a login prompt when going offline on a DVLS data source" added some extra check or something and is requiring a user session for all data source types.
If there's any other info I can help with, let me know!
Thanks,
Chris
PS Auth Changes?
Hello,
I just noticed this and might be able to help. Can you walk me through the environment for this and the commands you're trying? Do you have the Devolutions.PowerShell module installed on a Windows server with Ansible and then having Ansible run playbooks using the module against remote Windows machines? If so, are you using a local RDM instance and connecting to a remote PowerShell session on the Ansible server (with another instance of RDM installed) and invoking playbooks that way?
Hey,
What you outlined is mostly correct. The Ansible server is on a separate Ubuntu machine which ps remotes to a Windows server to execute the RDM commands. From there the server executes the powershell scripts using the Devolutions.PowerShell module with parameters passed in from the Ansible playbooks.
As noted above, this method works fine with module version 2024.1.3 . Something between that and current it now throws extra auth errors. I've tested this multiple times by upgrading/downgrading the module on the server.
Thinking about it, I could try interim versions to see if I can narrow where it breaks.
Got it. So you have a local RDM instance connecting to the Ubuntu server running Ansible via a remote PowerShell session? How is Ansible authenticating to the remote Windows servers?
There isn't an instance of RDM involved. It's simply ansible -> calling remote powershell -> powershell/RDM module in Windows.
It's using a domain user to connect to the server and the server has a local user to connect to the db to avoid that specific "double hop" issue.
I'm guessing something in 2024.3.x is getting caught by the domain prompt required for RDM, but I don't know why that would be or if there is a new setting or method.
We'll see once the devs have a chance to look and I can get a specific version of breaking.
PS Auth Changes?
Hello Chris,
I don’t recall any recent changes to the authentication process. To help troubleshoot the issue, I’ll try to reproduce the error.
To proceed, could you please provide the following details?
What type of data source are you using (e.g., Devolutions Server), and what is its version?
Are you using an application to connect?
Best regards,
Maxime
Hey,
So it looks like it's something between 2024.2.7 and 2024.3.9 that the break is happening. I'll try to step through each version tomorrow and see if I can find the exact breaking point.
Thanks,
Chris
PS Auth Changes?
Hello,
I just noticed this and might be able to help. Can you walk me through the environment for this and the commands you're trying? Do you have the Devolutions.PowerShell module installed on a Windows server with Ansible and then having Ansible run playbooks using the module against remote Windows machines? If so, are you using a local RDM instance and connecting to a remote PowerShell session on the Ansible server (with another instance of RDM installed) and invoking playbooks that way?
Hey,
What you outlined is mostly correct. The Ansible server is on a separate Ubuntu machine which ps remotes to a Windows server to execute the RDM commands. From there the server executes the powershell scripts using the Devolutions.PowerShell module with parameters passed in from the Ansible playbooks.
As noted above, this method works fine with module version 2024.1.3 . Something between that and current it now throws extra auth errors. I've tested this multiple times by upgrading/downgrading the module on the server.
Thinking about it, I could try interim versions to see if I can narrow where it breaks.
PS Auth Changes?
Hello Chris,
I don’t recall any recent changes to the authentication process. To help troubleshoot the issue, I’ll try to reproduce the error.
To proceed, could you please provide the following details?
What type of data source are you using (e.g., Devolutions Server), and what is its version?
Are you using an application to connect?
Best regards,
Maxime
Hey,
The data source we're using is MS-SQL. The user to log into the powershell server is a domain user, but the RDM/db user is local. This avoids that specific "second hop" problem.
Technically the application we're using to connect is Ansible with powershell remoting, but I feel any remote powershell would produce the same result.
Thanks,
Chris
PS Auth Changes?
We currently use ansible to remotely execute powershell scripts that use the Devolutions.PowerShell module to automate various credentials and whatnot.
When running 2024.1.3, everything works as expected. However, when I update to 2024.3.4, I'm getting "second hop" errors from PowerShell unless I'm physically logged into the server. Our policy does require that a domain user log into the RDM application, but the ps module has never required this.
I dug through all the module changelogs, but don't see anything about this. Is there some new authentication process between powershell and the RDM application that needs to be done? Not sure what else I could be missing.
Thanks,
Chris
Setting Connection Permissions
I'm trying to create a new entry in a MS-SQL data source. I will check that script out!
Thanks,
Chris
Setting Connection Permissions
Hey,
I'm trying to set the following permissions to a new entry via the latest powershell module:
<Security>
<Permissions>
<ConnectionPermission>
<Override>Never</Override>
<Right>Edit</Right>
</ConnectionPermission>
<ConnectionPermission>
<Override>Never</Override>
<Right>Delete</Right>
</ConnectionPermission>
</Permissions>
<RoleOverride>Custom</RoleOverride>
</Security>
I already have the role override and new object creation working, but I'm not seeing a cmdlet or anything that lets me add a new ConnectionPermission to the Security.Permissions array.
Is there a way to do this?
Thanks,
Chris
Allow user group(s) access to vault
Ah, that was it. I put that link at the top of my code for easier reference.
Thanks!
Allow user group(s) access to vault
Ahh. I had forgotten to set the Vault current before getting the Root session. Working great now!
I recall a resource that showed all the objects and their properties or a way to iterate them. Does something like that still exist?
Thanks,
Chris
Allow user group(s) access to vault
That worked great! However, it looks like New-RDMRepository doesn't create a Vault that uses the default inherited permissions. I seem to have forgotten the command I can use to iterate over an object and get all its properties.
Is there a way to set the new vault to Inherit instead of Never?
Thanks,
Chris
Allow user group(s) access to vault
Hey,
I have developed a process that creates credentials and vaults as needed. However, when a new vault is created, I have to manually add it to the user groups that our users belong to in order for them to use it.
Is there a way to script this or automate it in some way? I've looked through the powershell functions and nothing obvious is jumping out at me.
Thanks,
Chris
New WebBrowser entry in Private browser
Hey,
I'm using the following code to create a new web browser entity:
$wb = New-RDMSession -Name $EntryName -Type WebBrowser -Group "$g" -ErrorAction Stop
$wb.Host = $Hostname
$wb.OpenEmbedded = $falseIs there a way to specify it should be in a private web browser?
I've looked through an object via Get-RDMSession, but I'm not seeing anything that might specify a private browser.
Thanks,
Chris
Apply Inherited Permissions
Ah, thanks for that. It seemed odd there wasn't a way to simplify that check.
Thanks!
Apply Inherited Permissions
Setting it to "Default" worked. There is some typing weirdness in PowerShell where the $null check was still being successful despite not being provided.
Thanks for the help.
Chris
Apply Inherited Permissions
I'm using the following code to set specific permissions to new credential entries.
if($ViewPermissionGroup -ne $null) {
$cr.Security.RoleOverride = "Custom"
$cr.Security.ViewOverride = "Custom"
$cr.Security.ViewRoles = $ViewPermissionGroup
}This works great when $ViewPermissionGroup is defined. However, all other credentials aren't inheriting the correct permissions.
I've tried setting $cr.Security.RoleOverride to "Default" and "Inherited" with the same wrong results. The new entry does not inherit the permissions from the vault/folder.
Is there some way to getting new entries the inherited vault/folder permissions instead of "Custom"?
I didn't see anything in the example scripts on how to do this.
Thanks,
Chris
WARNING: Unable to save the entry; access denied - more details?
When I was looking at the log, the working vault clearly pulled all groups and other entries in the vault. With the non-working one, it was clearly pulling from some cache or something because it didn't pull any info in the vault at all (and there is a lot).
Adding the Update-RDMEntries seems to have taken care of it with the few tests I have run.
Thanks for all the help! Hopefully this has taken care of it!
Chris
WARNING: Unable to save the entry; access denied - more details?
It looks like I have an instance where it's consistently working in one vault and not in others. The process is the same regardless of the vault being used. All vaults are applied with the same template in the data source.
Are there any logs or debugs I can provide that might help narrow down what is happening?
Thanks,
Chris
WARNING: Unable to save the entry; access denied - more details?
The user is not an administrator. The script user is a basic user (not restricted) and only has global View/Add permissions to the vaults for security purposes and to prevent accidents.
The data source and vaults are always existing before the script is used (essentially a new or existing site). All vaults have the same template applied from the data source settings.
Let me know if there are other ways I can help track this down.
Thanks,
Chris
WARNING: Unable to save the entry; access denied - more details?
Hey Maxime,
Will I see that in the PowerShell output or would it be in one of the logs? If it's in the log, which one?
I'm not seeing any new messages in the PowerShell output/stderr after enabling that debug on the host.
Thanks,
Chris
WARNING: Unable to save the entry; access denied - more details?
Hello,
You can use the parameter -ErrorVariable 'VariableName' on the problematic line or the global variable $Error to access the error variable. Looking at your script, you will need to change the ErrorAction -Stop of the Set-RDMSession to add a check on the error variable and print the mentioned property (ex: $Error[0].TargetObject).
But if you prefer to not modify your script, I could an additionnal verbose with the target object string directly.
The script is pretty easy to modify. I added `Write-Host $Error[0].TargetObject` right after the `Set-RDMSession` and took out Stop action.
I'm not seeing the "access denied" any more (?), but this is what the output is now. It silently failed to add the entry this time.
VERBOSE: [Get-RDMDataSource] Star
VERBOSE: [Get-RDMDataSource] Start
VERBOSE: [Get-RDMDataSource] Finish
VERBOSE: [Get-RDMVault] Start
VERBOSE: [Get-RDMVault] Finish
VERBOSE: [Set-RDMCurrentVault] Start
VERBOSE: [Set-RDMCurrentVault] Finish
VERBOSE: [New-RDMSession] Start
VERBOSE: [New-RDMSession] Finish
VERBOSE: [Set-RDMSession] Start
VERBOSE: [Set-RDMSession] Finish
{ EntryIsNull: False, IsReady: True, IsOffline: False, IsExternalRepository: False, CanAddInRoot: False, CanAdd: False }
Not sure about the CanAddInRoot as the DataSource default is True, but it's also not adding to the root. It's set to add to a subfolder.
Also not sure why CanAdd is False.
Thanks,
Chris
EDIT: The "access denied" is in StandardError now and I missed it. It's still there.
WARNING: Unable to save the entry; access denied - more details?
Hello,
So far, I have not been able to reproduce the issue. In the version 2023.2..0.6 of the module, some error messages have been added to better understand why it fails. The FullyQualifiedErrorID and TargetObject fields will help target the origin of the failure.
Is there an extra flag that is needed? The output looks more or less the same to me.
VERBOSE: [Get-RDMDataSource] Start
VERBOSE: [Get-RDMDataSource] Start
VERBOSE: [Get-RDMDataSource] Finish
VERBOSE: [Get-RDMVault] Start
VERBOSE: [Get-RDMVault] Finish
VERBOSE: [Set-RDMCurrentVault] Start
VERBOSE: [Set-RDMCurrentVault] Finish
VERBOSE: [New-RDMSession] Start
VERBOSE: [New-RDMSession] Finish
VERBOSE: [Set-RDMSession] Start
Set-RDMSession: Z:\SCRIPTS\powershell\Create-RDMCredential.ps1:46
Line |
46 | Set-RDMSession $cr -ErrorAction Stop -Verbose
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Unable to save the entry; access denied
Installed Version:
Binary 2023.2.0.6 Devolutions.PowerShell
Thanks,
Chris
WARNING: Unable to save the entry; access denied - more details?
It has randomly stopped working again with no changes to the script or server. It is run via remote powershell from Ansible, so there is no shell or connection to be left open. This is what I get with -Verbose enabled on every step. There is no indication of any error until it actually saves the entry and that is "access denied".
[33;1mVERBOSE: [Get-RDMDataSource] Start[0m
[33;1mVERBOSE: [Get-RDMDataSource] Finish[0m
[33;1mVERBOSE: [Get-RDMVault] Start[0m
[33;1mVERBOSE: [Get-RDMVault] Finish[0m
[33;1mVERBOSE: [Set-RDMCurrentVault] Start[0m
[33;1mVERBOSE: [Set-RDMCurrentVault] Finish[0m
[33;1mVERBOSE: [New-RDMSession] Start[0m
[33;1mVERBOSE: [New-RDMSession] Finish[0m
[33;1mVERBOSE: [Set-RDMSession] Start[0m
[33;1mWARNING: Unable to save the entry; access denied[0m
[33;1mVERBOSE: [Set-RDMSession] Finish[0m
I can manually add the entry with the same vault, name, username, and password on the server as the user running the powershell script with no errors so that tells me it isn't password complexity or something else.
If it was an actual db or user auth issue, I would expect the data source or vault select to throw an error, but that isn't the case.
Is there any way to get more detail of what is going on?
Thanks,
Chris