Save recurring script configurations in your PowerShell profile and have them always available via the $PSSCriptConfig variable.
Install-Module PSScriptConfig
Import-Module PSScriptConfig
Register-PSScriptConfigNew-PSScriptConfig -Key mailRelay -Value mail.contoso.comNew-PSScriptConfig -Key mailRelayPort -Value 25New-PSScriptConfig -Key mailFrom -Value admin@contoso.com$PSScriptConfig$PSScriptConfig.mailRelayFor the current session only.
$PSScriptConfig.mailRelay = "smtp.contoso.com"Save permanently.
Save-PSScriptConfigRemove-PSScriptConfig -Key mailRelaySend-MailMessage -From $PSScriptConfig.mailFrom -SmtpServer $PSScriptConfig.mailRelay -Port $PSScriptConfig.mailRelayPort -To me@contoso.com -Subject test