Open local Powershell profile in Notepad:
notepad $PROFILE.CurrentUserCurrentHost
Add following line in your profile file, save, close it.
$PSDefaultParameterValues['Invoke-Sqlcmd:Encrypt'] = 'Optional'
Note: Create Powershell profile if not already existing:
if (-not (Test-Path $PROFILE.CurrentUserCurrentHost)) {
New-Item -Path $PROFILE.CurrentUserCurrentHost -ItemType File -Force
}