Quantcast
Channel: Why are variables not working with Get-Aduser in powershell? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Why are variables not working with Get-Aduser in powershell?

$
0
0

Looking for a little explanation as to why this isn't working and what I might be doing wrong. Any Help would be great!

Expected Results :BSMITH

Get-Aduser -filter {(givenname -eq "Bob") -and (surname -eq "Smith"))} | select-object SamAccountName

Result :BSMITH

Works Fine. Good to go


Expected Result :BSMITH

$textbox_FirstName = "Bob"$textbox_LastName = "Smith"Get-Aduser -filter {(givenname -eq "$textbox_FirstName.text") -and (surname -eq "$textbox_LastName.text")} | select-object SamAccountName

Result : (Blank Nothing)

I have tried givenname -eq "$textbox_FirstName.text" without quotes, without .text, with no quotes at all. Still no results :(


Viewing all articles
Browse latest Browse all 2

Trending Articles