Changing Certain Values to Other Values before PIPING them to a command.
For Example you have a .csv file with values like Job Title and Name that you want to convert to other values, you can use this syntax.
the n= is a short version of Name= and the e= is a short version of expression=
@{n='title';e={$_.'Job Title'}},@{n='samaccountname';e={$_.name}}
So the normal command would be like
import-csv users.csv | select Name,Department,City,'Job Title',Name | new-aduser
which will NOT work because 'Job Title' and Name or not Valid values for the new-aduser command.
We change the values to 'title' and 'samaccountname' like this
import-csv users.csv | select Name,Department,City,@{n='title';e={$_.'Job Title'}},@{n='samaccountname';e={$_.name}} | new-aduser
You may ask yourself why don't you add the right values in the .csv out of the box.. because maybe this CSV need to be filled in by a person that does not understand samccountname of other values :-)