What does the N and E represent in this select statement

Question:


Can someone describe this line? What does the “N” and “E” stand for?

select @{N='Server'; E={$computer}}, @{N='Domain'; E={$_.Context.Name}}, samaccountName

What I want is the output to look like the following and I want to flag the users in the admin group that are NOT apart of our standard setup. Really I want to ignore the SAM accounts that are the domain accounts but flagging them for now works. What is happening is there is a looping through the SAM accounts to create this output. However when the machine is offline I need to make that too.

EXample Output

Answer:

You are looking at the short hand for the key and value of a calculated property. “N” is short for Name. “L” or Label is also used in place of Name. “E” of course is for Expression.

They are used when you want to manipulate existing properties or as a simple way to add properties. It is by no means the only way.

One of the Windows PowerShell Tips of the Week from TechNet delves into a great example:

Length is in bytes normally. A calculated property is used here to allow for a more human readable number. This is an example of manipulating a property.

In your case it looks like you are taking a list of members and creating output for each member while referencing the server it was attached to. Presumably that information is not normally present, hence the calculated property.

Source:

What does the N and E represent in this select statement by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply