header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

converting stringvalue to System.Security.SecureString
Last Post 16 Jan 2008 01:10 AM by smurawski. 2 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
yefimovahUser is Offline
New Member
New Member
Posts:24
Avatar

--
16 Jan 2008 12:30 AM  

Hi,

Is there a way to convert a string to a secure string other than?

$password = Read-Host "Enter password" -AsSecureString

Cannot bind parameter 'ConnectionPassword'. Cannot convert value "string" to type "System.Security.SecureString"

smurawskiUser is Offline
New Member
New Member
Posts:46

--
16 Jan 2008 01:07 AM  
There are two cmdlets you might find helpful - ConvertTo-SecureString and ConvertFrom-SecureString. If you are trying to get credentials (username and password), the Get-Credential cmdlet might work for you. (Its password property is a secure string.)
Steven Murawski
Co-Host - Mind of Root (www.mindofroot.com)
Host - PowerShell Basics (powershell-basics.com)
smurawskiUser is Offline
New Member
New Member
Posts:46

--
16 Jan 2008 01:10 AM  
Oh, if you use the Get-Credential and you need to get the unencrypted password, you can access it like this:
$credential = Get-Credential
$credential.GetNetworkCredential().Password
Steven Murawski
Co-Host - Mind of Root (www.mindofroot.com)
Host - PowerShell Basics (powershell-basics.com)
You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer