79153071

Date: 2024-11-03 15:47:18
Score: 0.5
Natty:
Report link

This issue isn't reproducible in PowerShell 7 latest, but in Windows PowerShell 5.1 Group-Object with a string property (-Property weight) doesn't know how to handle incoming hash tables (@{ ... }) from pipeline but you can help it using a calculated expression instead:

@(
    @{ name = 'a' ; weight = 7 }
    @{ name = 'b' ; weight = 1 }
    @{ name = 'c' ; weight = 3 }
    @{ name = 'd' ; weight = 7 }
) | Group-Object -Property { $_.weight } -NoElement
Reasons:
  • RegEx Blacklisted phrase (3): you can help
  • Has code block (-0.5):
  • High reputation (-2):
Posted by: Santiago Squarzon