When using Visual Studio Code and PSverion 7.2.6 I am no longer able to use a variable in Get-ADUser Filter.
Command:
Get-ADUser -server $DC -Filter 'sAMAccountName -eq $Input' -Properties $sProperties | Select $sProperties
getting this error:
Get-ADUser: Variable: ‘Input’ found in expression: $Input is not defined.
That works fine in PowerShell ISE ver 5.1.
2
Answers
I played with the quotation marks ("sAMAccountName -eq 'Input'") and found the solution:
try this