Simple way to store credentials in Powershell

I know this is not the most secure way to store credentials but it works and is simple to manage. I use this when I need creds stored for accessing web based resources. To use it run the following: [code lang=“ps”] #To set Credentials Set-MyCredential -File c:\temp\thecreds.dat #To get Credentials $creds = Get-MyCredential -User domain\user -File c:\temp\thecreds.dat function Set-MyCredential($File) { $Credential = Get-Credential $credential.Password | ConvertFrom-SecureString | Set-Content $File } function Get-MyCredential($User, $File) { $password = Get-Content $File | ConvertTo-SecureString $credential = New-Object System.Management.Automation.PsCredential($user,$password) $credential } [/code]