PowerShell (PowerCLI) : Password in Variable

Implemented

PowerShell (PowerCLI) : Password in Variable

avatar

Hi .. I've asked this before, and I fixed it at the time .. but I can't seem to make it work any more (think I am losing it).

I have a PowerShell session created to run the PowerCLI for VMware as an 'embedded script'.
In the script I have the correct string ..

Connect-VIServer -Server $HOST$ -User $USERNAME$ -Password $PASSWORD$

And in the session under "Security Settings", I have the check for "Allow Password in Variable"

But when I open the session it looks like it's not passing the password, and when I add a 'Write-Host' to print the $PASSWORD$ ... it just shows "$"

Is there somewhere else in RDM that has this setting ?
I've looked over my old post and other posts, and I can't seem to pin it down.

This used to work .. and then I ran into a problem with having a special char in the password, but now I can't even get it to run properly.
(I did recreate my datasource)

Connect-VIServer : 2022-10-27 4:55:36 PM Connect-VIServer Cannot complete login due to an incorrect user name or password.
At C:\Users\Ivan\AppData\Local\Temp\RDM\1601823c-198d-457a-ae61-783bc8056b77.ps1:1 char:1
+ Connect-VIServer -Server vCenter -User Ivan -Pas ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Connect-VIServer], InvalidLogin
+ FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_SoapException,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer

All Comments (13)

avatar

Hello,

Could you please make sure that the Allow password in variable option is enabled under Security Settings? That should solve your issue.

forum image

Best regards,

Érica Poirier

avatar

Yup .. I have that one .. hence why I was asking if there was another place I was missing.

forum image

avatar

Hello,

Thank you for your feedback and sorry that I have missed this information in your first post.

If you are using a credential entry, on this entry too you need to enable the same option.

If it's still not working, please verify that the Allow password variables for all entries option is enabled in Administration - System Settings - Password Policy.

forum image

Best regards,

Érica Poirier

avatar

Hi .. Did not notice it on the Cred .. tried that, still no bones.

I've seen mention of the 'Administration - System Settings' .. But when I click on the 'Administration' button, I don't see a 'System Settings'
Any clues where it is ?

forum image

avatar

Hello,

Are you using a Local Data Source?

The System Settings button is available only on advanced data sources.

I tried the same script on my Local Data Source and it's working properly.

What RDM version are you using?

Best regards,

Érica Poirier

avatar

Hi ..

Yes, I am using a local Data Source (XML), which I backup to the Devolutions storage drive.
I don't see any 'Advanced' Data Source option.

RDM : 2022.2.26.0 64bit


forum image

avatar

OK .. Just tried it on a new RDM install (in a VM), and it works.

No matter .. I think I've gone weird somewhere .. Thanks for assisting.

avatar

Hello,

Thank you for your feedback and glad you were able to get it working on another machine.

Don't hesitate to contact us again if you need further assistance on that matter.

Best regards,

Érica Poirier

avatar

Hi .. One additional thing .. I asked this in the last post I did, but we didn't get anywhere.

When it works .. it returns to the "Prompt", but that is at the working directory for RDM.

PS C:\Program Files (x86)\Devolutions\Remote Desktop Manager>

Is there a way to change the prompt with the 'Embedded Script' method ?
Some of the things I type next are really long one-liners, and this already takes nearly 50% of the line.
I know I could just do a change each time I use it, but maybe there is some way to do a post typing macro or something like that ?

avatar

Hello,

I will check with the engineering team if there is a method or a parameter to set the working directory when using PowerShell.

Thank you for your patience.

Best regards,

Érica Poirier

avatar

OK .. Thank You ..

For now I have figured in a 'After Open' typing macro with a delay that I worked out via trial & error.
But it would be nice to have a better solution.

Especially as there seems to be an option about 'No Profile', which implies a Profile that maybe I could edit.

avatar

Hello,

Thank you for your feedback.

A ticket has been submitted to our engineering team to add an option to specify a working directory different than the RDM's installation directory.

Once an update will be available, we will post it here.

Thank you for your patience.

Best regards,

Érica Poirier

avatar

Hello,

The improvement to change the default working directory for PowerShell session entry is available in the latest RDM version 2022.3.31.

forum image

Best regards,

Érica Poirier