通过命令使用 AsPlainText 参数ConvertTo-SecureString 可以公开安全信息。 方式 使用标准加密变量执行任何 SecureString 转换。 建议 如果需要从某个位置检索密码而不提示用户,请考虑使用 Galeria programu PowerShell 中的 SecretStore 模块。 示例 错 PowerShell 复制 $UserInput = Read...
ConvertTo-SecureString[-String] <String> [-Key <Byte[]>] [<CommonParameters>] 说明 ConvertTo-SecureStringcmdlet 将加密的标准字符串转换为安全字符串。 它还可以将纯文本转换为安全字符串。 它与ConvertFrom-SecureString和Read-Host一起使用。 cmdlet 创建的安全字符串可与需要类型为SecureString的参数的 cmdlet...
ConvertFromSecureStringCommand Constructors Properties AsPlainText SecureString ConvertFromStringDataCommand ConvertFromToSecureStringCommandBase ConvertPathCommand ConvertToCsvCommand ConvertToHtmlCommand ConvertToJsonCommand ConvertToSecureStringCommand ConvertToXmlCommand ...
New-ADUser -Name "New User" -GivenName "New" -Surname "User" -UserPrincipalName "newuser@yourdomain.com" -Path "OU=Users,DC=yourdomain,DC=com" -AccountPassword (ConvertTo-SecureString "Password123" -AsPlainText -Force) -PasswordNeverExpires $true -Enabled $true 计算机帐户管理 删除计算机帐...
$username="test\Administrator"$password=echo"123456"| ConvertTo-SecureString -AsPlainText -Force$c= New-Object System.Management.Automation.PSCredential$username,$passwordInvoke-Wmicommand -Payload {1+1} -ComputerName'192.168.1.1'-Credential$Credentials ...
$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 ...
ConvertTo-SecureString [[-SecureKey] <SecureString>] [-String] <string> [<CommonParameters>] 说明 ConvertTo-SecureString cmdlet 将加密的标准字符串转换为安全字符串。它还可以将纯文本转换为安全字符串。此 Cmdlet 与 ConvertFrom-SecureString 和 Read-Host 一起使用。该 cmdlet 创建的安全字符串可以与需要类...
ConvertTo-SecureString"MyPlainTextPassword"-AsPlainText-Force 需要提供“AsPlainText”和“强制”参数。 如果没有提供这些参数,你将收到一条警告消息,其中会提示你不得将纯文本传递到安全字符串中。 由于纯文本密码会记录在各种日志中,因此 PowerShell 会返回此警告。 创建安全字符串后,需要将其传递到PSCredential...
使用SecureString类型:SecureString是一种特殊的数据类型,用于存储敏感信息,如密码。它可以加密并在内存中保持安全。在Powershell中,可以使用以下命令创建SecureString类型的变量: 代码语言:powershell 复制 $securePassword = ConvertTo-SecureString -String "password" -AsPlainText -Force ...
Converts plain text or encrypted strings to secure strings.SyntaxPowerShell Kopioi ConvertTo-SecureString [-String] <String> [[-SecureKey] <SecureString>] [<CommonParameters>]PowerShell Kopioi ConvertTo-SecureString [-String] <String> [-AsPlainText] [-Force] [<CommonParameters>]...