I am having a hard time here on this one and I know its probably a simple syntax problem. I don't know how to pass this variable into the code chunk and have it acknowledged correctly.
$user = "Some.Person"
This works as I would expect.
get-aduser -filter {(Samaccountname -eq $user)}
This does not
get-aduser -filter {(userprincipalname -like $user*)}
tried with variations of "$user*"
, "'$user*'"
as well as some others to no avail.
final outcome would be use like follows because we have AD accounts where UPN is different than UserName and I have a whole listing of Username formatted values I need to confirm still exist with active accounts.
Get-ADUser -Filter {(UserPrincipalName -like "$user*") -or (SamAccountName -eq "$user")} -SearchBase "" -Server "MyServer:3268"