79804146

Date: 2025-10-29 19:26:29
Score: 0.5
Natty:
Report link

What is @{n='BusType';e={$disk.bustype}}? AI gave me similar examples, I just barely understand it. Seems n & e as shortcuts for Name & Expression in so called Calculated Property Syntax.

@{Name='PropertyName'; Expression={Script Block}} or @{n='PropertyName'; e={Script Block}}.

AI suggested an example:

Get-ChildItem -File | Select-Object Name, @{n='SizeMB'; e={$_.Length / 1MB}}

demonstrating exactly what I desired to archive, then why does @{n;e} act strangely in Select-Object?

Reasons:
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Self-answer (0.5):
  • Starts with a question (0.5): What is
  • High reputation (-2):
Posted by: gavenkoa