I\'d like to check if a user account already exists in the system.
$SamAc = Read-Host \'What is your username?\'
$User = Get-ADUser -Filter {sAMAccountName -
Okay, I got mine to finally work using the following syntax and using the following example from up above:
Previously:
$User = Get-ADUser -Filter "sAMAccountName -eq '$SamAc'"
Working Version:
$user = Get-aduser -Filter "sAMAccountName -eq '$($SamAc)'"
I had to add $($ ) to $SamAc before PowerShell could access the variable string value.