Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Embedded Credentials in a PowerShell Script
$username = ""
$password = "Password123!@#"
$secureStringPwd = $password | ConvertTo-SecureString -AsPlainText -Force
$creds = New-Object System.Management.Automation.PSCredential -ArgumentList $user, $secureStringPwd

This comment has been minimized.

Copy link

@yiannosven yiannosven commented Jan 5, 2018

Hey Dave,
Thank you for this.
Just thinking, the $user variable in the last line should prolly be $username no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.