Trouble with embedding secured password

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 9 months and 5 days old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
vAdmin-Jerusalem
Posts: 1
Last visit: Wed Jan 31, 2024 3:23 am

Trouble with embedding secured password

Post by vAdmin-Jerusalem »

Im trying to use the password credentials tool, within Sapien Powershell Studio. My goal is to replace the clear text password with encrypted password in my scripts, therefore im using the $SAPIENHost.GetPassword(index) to obtain a SecureString object containing password.

But its doesn’t work, firstly when im typing $SAPIENHost powershell studio doesn’t recognize it.
Secondly I receive errors that the user name and the password aren’t recognizable.

This is how im embedding the $SAPIENHost.GetPassword(index) :

set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $true -Confirm:$false
set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false
$VcPassword = $SAPIENHost.GetPassword(0)
$SecurdVcPassword = ConvertTo-SecureString $VcPassword -AsPlainText -Force
$VcCred = New-Object System.Management.Automation.PSCredential ('system_task@www.jerudom1.co.il', $SecurdVcPassword)
Connect-VIServer -Server $script:seclectvc -Credential $VcCred

Thank you in advance
User avatar
brittneyr
Site Admin
Posts: 1803
Last visit: Tue Nov 05, 2024 11:31 am
Answers: 44
Been upvoted: 34 times

Re: Trouble with embedding secured password

Post by brittneyr »

Can you confirm if $SAPIENHost.GetPassword(0) is returning anything? You could check with a break point on that line or an output statement.
Brittney
SAPIEN Technologies, Inc.
This topic is 9 months and 5 days old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked