powershell PowerShell的SecureString.ps1

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell PowerShell的SecureString.ps1相关的知识,希望对你有一定的参考价值。

# Step 1 - Exporting SecureString from Plain text
"P@ssword1" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString | Out-File "C:\Temp 2\Password.txt"

# Step 2 - Creating PSCredential object
$User = "MyUserName"
$File = "C:\Temp 2\Password.txt"
$MyCredential=New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, (Get-Content $File | ConvertTo-SecureString)

# The Default Execution Policy is set to restricted, you can see it by typing:
Get-ExecutionPolicy
# You should type the following to make it go to unrestricted mode:
Set-ExecutionPolicy unrestricted

以上是关于powershell PowerShell的SecureString.ps1的主要内容,如果未能解决你的问题,请参考以下文章

来自powershell错误的SQL“日志字节刷新/秒”计数器

在域中使用 powershell 查找安装了打印机的打印服务器

powershell和powershell ise到底分别干啥用,powershell命令那么长怎么记

powershell怎么运行

powershell 测量PowerShell命令或PowerShell脚本的速度

powershell远程下载exe并执行