ConvertFrom-SecureString Set-…

What you have stored in the registry is an

encrypted

$path = "HKCU:\SOFTWARE\PowerShellCred"
$sec = Read-Host "Enter Password for $name" -AsSecureString
$hash = $sec | ConvertFrom-SecureString
Set-ItemProperty -Path $path -Name $admin -Value $hash -Force

string, not real

$admin = "xxxxxx@xxxx.com"
$pass = (Get-ItemProperty -Path $path -Name $name -ErrorAction SilentlyContinue)."$name"
$secpw = ConvertTo-SecureString -String $pass -AsPlainText -Force
$c = New-Object System.Management.Automation.PSCredential ($admin, $secpw)
$Azurelogin = Connect-AzureRmAccount -Credential $c

. Something like

解决方案:

as you would when converting a ‘normal’ string like .TryPlainText 01000000d08c9ddf0115d1118c7a00c04fc297eb010000001a114d45b8dd3f4aa11ad7c0abdae9800000000002000000000003660000a8000000100000005df63cea84bfb7d70bd6842e7
efa79820000000004800000a000000010000000f10cd0f4a99a8d5814d94e0687d7430b100000008bf11f1960158405b2779613e9352c6d14000000e6b7bf46a9d485ff211b9b2a2df3bd
6eb67aae41

我已经创建了一个注册表文件来保存Azure密码。-AsPlainText但在调用的密码,我有麻烦在解密密码使用ConvertTo-SecureString。我使用相同的用户帐户创建密码和访问它(管理)。-Force P@ssW@rd

我已经创建了一个注册表文件来保存Azure密码。$path = “HKCU:\SOFTWARE\PowerShellCred” $sec = Read-Host “Enter Password for $name” -AsSecureString $hash = $sec

给TA打赏
共{{data.count}}人
人已打赏
未分类

.NET Blazor在构建应用程序时出现MSB3073错误,但如何解决,删除Blazor.MonoRuntime.target中的行并不能使其生效。

2022-9-9 0:11:17

未分类

拦截所有javascript中的函数调用

2022-9-9 0:11:19

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索