PowerShell

using "-Filter" and "-Like" with a variable

I’ve got a hair pulling problem (I think)
Here’s the code:
$dn="abc.com"
Get-Recipient -Filter {EmailAddresses -Like ‘$dn’} — didn’t work
Get-Recipient -Filter {EmailAddresses -Like ‘*$dn*’} — didn’t work
Get-Recipient -Filte…

Powershell use Read-Host variables in command

I have a very simple .ps1-script:
$prename = Read-Host ‘What is your prename?’
$lastname = Read-Host ‘What is your lastname?’
.\migration.exe -name=$prename -password=$lastname

Regardless of what the user enters, $prename and $lastname do…