In SQL I can go SELECT actualField, "repeat" AS bs_repeated_value FROM Table1
And I can repeat the bs_repeated_value
field as many times as there are rows no matter what I name the field!
Now in a similar and like manner in Powershell I can…almost…do the same thing, except for what I mentioned above…
get-ADUser -SearchRoot 'boogers.com/Locations/Kleenex' | Where-Object { $_.TITLE -ne 'Snot' } | Select LastName,FirstName,Description,SamAccountName,Department,TITLE, @{'bs_repeated_value' = 'repeat' }
Is there no way to do this?
Advertisement
Answer
Okay I’m doing this wrong…here is how it works, although it’s a bit less elegant than say your SQL syntax…
get-ADUser -SearchRoot 'boogers.com/Locations/Kleenex' | Where-Object { $_.TITLE -ne 'Snot' } | Select LastName,FirstName,Description,SamAccountName,Department,TITLE, @{Name='bs_repeated_value';Expression={'repeat'}}
References: