这是一个加密的标准字符串。因此,在传递给SecureStringToBSTR之前,对此调用ConvertTo-SecureString。
以下是如何提示输入SecureString并将其作为加密的标准字符串写入文本文件:
ConvertTo-SecureString参考 反馈 模块: Microsoft.PowerShell.Security 将纯文本或加密字符串转换为安全字符串。语法PowerShell 复制 ConvertTo-SecureString [-String] <String> [[-SecureKey] <SecureString>] [<CommonParameters>]PowerShell 复制 ConvertTo-SecureString [-String] <String> [-AsPlainText]...
ConvertTo-SecureString [-String] <String> [[-SecureKey] <SecureString>] [<CommonParameters>]PowerShell 複製 ConvertTo-SecureString [-String] <String> [-AsPlainText] [-Force] [<CommonParameters>]PowerShell 複製 ConvertTo-SecureString [-String] <String> [-Key <Byte[]>] [<CommonParameters>...
ConvertTo-SecureString [[-SecureKey] <SecureString>] [-String] <string> [<CommonParameters>] 说明 ConvertTo-SecureString cmdlet 将加密的标准字符串转换为安全字符串。它还可以将纯文本转换为安全字符串。此 Cmdlet 与 ConvertFrom-SecureString 和 Read-Host 一起使用。该 cmdlet 创建的安全字符串可以与需要类...
$pwd=ConvertTo-SecureString-String"Admin_123456"-Force-AsPlainText Get-ChildItem-Path'Cert:\CurrentUser\My'|Where-Object{$_.Subject-match"mylab.wang.io"}|Export-PfxCertificate-FilePathC:\Users\Administrator\Desktop\cert\mylab.wang.io.pfx-Password $pwd ...
ConvertFrom-SecureStringcmdlet 可将安全字符串 (System.Security.SecureString) 转换为加密的标准字符串 (System.String)。和安全字符串不同,加密的标准字符串可保存在文件中以供以后使用。 加密的标准字符串可转换回它的安全字符串格式,方法是使用ConvertTo-SecureStringcmdlet。
ConvertTo-SecureString [-String] <String> [[-SecureKey] <SecureString>] [<CommonParameters>]PowerShell Kopija ConvertTo-SecureString [-String] <String> [-AsPlainText] [-Force] [<CommonParameters>]PowerShell Kopija ConvertTo-SecureString [-String] <String> [-Key <Byte[]>] [<CommonParameter...
$newPassword=ConvertTo-SecureString'Admin_123458'-AsPlainText-Forcetry{$userPrincipal.ChangePassword([Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($oldPassword)),[Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::...
$pwd = ConvertTo-SecureString "你的密碼" -AsPlainText -Force $cred = New-Object System.Management.Automation.PSCredential "你的帳號",$pwd $param = @{ SmtpServer = '你的SMTP' Port = 你的SMTP Port UseSsl = $true #如果有加密 Credential = $cred From = '寄件人' To = '收件人' Subject...