$ErrorActionPreference = 'Stop' . (Join-Path $PSScriptRoot 'mail-common.ps1') $context = Get-MailContext $password = Read-Host 'Enter SMTP password (stored with Windows user protection)' -AsSecureString if ($password.Length -eq 0) { throw 'Empty SMTP password was not saved' } try { Save-SmtpPassword -Context $context -Password $password Write-Output 'SMTP password saved to the local MDB for this Windows user.' } finally { $password.Dispose() }