Using powershell to change lines in post login commands?

Using powershell to change lines in post login commands?

avatar

I have several servers that require a OneLogin OTP to get to them. The OTP login is done on a mercury bastion server, and from there we log into our destination server. I've setup the OTP login easily, and then given a post login command to login to the destination server. This requires a command line for the password of the destination server. See attachment with blurred password.

Is there a way using powershell or another tool to find/replace these passwords in an entire folder? If so, can you provide an example?

2023-10-08 03_40_14-Edit SSH Shell - CMSAPP1 NEW.png

All Comments (3)

avatar

Hello,

It is possible to use the Custom PowerShell Commands in the Edit Special Actions feature to replace the password on multiple selected entries.

Here is a sample script you can use.


$macros = $connection.Terminal.AfterConnectTerminalMacros
foreach ($macro in $macros)
{
	if ($macro.macro -eq "MyPassword")
	{
		$macro.macro = "MyNewPassword"
	}
}

$connection.Terminal.AfterConnectTerminalMacros = $macros
$RDM.Save()


Let us know if that helps.

Best regards,

Érica Poirier

e6356865-47c9-4582-8b25-7a6591c81932.png

avatar

I am new here, can I ask a question that I am facing?

avatar

Hello @annejones5643,

Sure, you can ask any questions. If it's not related to this subject, please create a new thread in the Support section.
https://forum.devolutions.net/forums/1/remote-desktop-manager--support

Best regards,

Érica Poirier