Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Notes for Powershell credentials

Here are some dirty ways to store user credentials in powershell.

Get-Credential | Export-Clixml C:\path\to\output\file.xml

The same user, on the same machine, that generates that file can retrieve the contents with

$credential = Import-Clixml C:\path\to\output\file.xml

Change password

2022-03-18
Set-ADAccountPassword -Identity bgstack15 -OldPassword (ConvertTo-SecureString -AsPlainText "OldPwGoesHere" -Force) -NewPassword (ConvertTo-SecureString -AsPlainText "NewPlainTextPw" -Force)

References

https://blogs.technet.microsoft.com/robcost/2008/05/01/powershell-tip- storing-and-using-password-credentials/

Comments