Help understanding strings in PS


folks i'm new powershell though have done programming in other langs.  can me understand difference in following:

1. 

$empid = "123456"

get-aduser -filter "employeeid -eq $empid"

(no output - doesn't seem work)

2. 

$test = "employeeid -eq '12346'"

get-aduser -filter $test

(get standard output seems work fine.

i have hard time understanding when variable have string, i'm guessing in 1 of above isn't simple old generic string?  i tried teh following also:

get-aduser - filter "employeeid -eq " + $empid

and fails also.  says can't figure out how add.. sure miss & type string concat old vbs days. . . 

thanks folks!!!

not sure brackets do, if read file tells how use cmdlet , parameters

get-help get-aduser -detailed


if find post has answered question, please mark answer. if find post helpful in anyway, please click vote helpful.



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

2008 Windows Deployment Server Properties Error

Can no longer user MS Update - Files required to use Microsoft Update are no longer registered

How do a find data in one file, search for it in another file and if not found, write a custom message to another file