Last active
June 25, 2018 21:36
-
-
Save richardsonlima/da5804138e4c98d745a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment