You can use the code below to save your password in an encrypted text file. This text file can be called to authenticate you in other sessions. It negates the need for you to manually authenticate or store your password in clear text.
$Username = $env:username $Folder = "\\server\folder" $CredsFile = "$Folder\$Username-PowershellCreds.txt" Write-Host 'Credential file not found. Please enter your password:' -ForegroundColor Red Read-Host -AsSecureString | ConvertFrom-SecureString | Out-File $CredsFile $Password = Get-Content $CredsFile | ConvertTo-SecureString