Quantcast
Viewing all articles
Browse latest Browse all 21975

Help understanding strings in PS

Folks I'm new to PowerShell though I have done some programming in other langs.  Can someone help me understand the difference in the following:

1. 

$EmpID = "123456"

Get-ADUser -Filter "EmployeeID -eq $EmpID"

(No output - doesn't seem to work)

2. 

$test = "EmployeeID -eq '12346'"

Get-ADUser -Filter $test

(Get standard output seems to work fine.

I have a hard time understanding when I variable I have is a string, I'm guessing in one of the above it isn't a simple old generic string?  I tried teh following also:

Get-ADUser - Filter "EmployeeID -eq " + $EmpID

And it fails also.  Says it can't figure out how to add.. I sure miss the & type string concat from the old VBS days. . . 

Thanks for any help folks!!!


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>