I cannot seem to use variable in the situation below.
[PS] C:\>Get-User -Filter {SamAccountName -eq "Test.Smith"}
Name RecipientType
---- -------------
Test Smith UserMailbox
[PS] C:\>$SamAccountName = "Test.Smith"
[PS] C:\>Get-User -Filter {SamAccountName -eq $SamAccountName}
[PS] C:\>echo $SamAccountName
Test.Smith
[PS] C:\>
You can see the command works fine when I type out the name, but not when I use a variable. Thanks!