0

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?

leeand00
  • 25,510
  • 39
  • 140
  • 297
  • 1
    Just a calculated property, right? For example (untested - writing on mobile): @{Name='NewDepartment'; Expression={$_.Department}} – Captain_Planet Aug 15 '19 at 23:38
  • @Captain_Planet Thank you, but I just needed a repeated value. I understand what you're doing though. – leeand00 Aug 15 '19 at 23:48

1 Answers1

1

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:

leeand00
  • 25,510
  • 39
  • 140
  • 297