Title: Add Where-Object -Not support · Issue #3529 · PowerShell/PowerShell · GitHub
Open Graph Title: Add Where-Object -Not support · Issue #3529 · PowerShell/PowerShell
X Title: Add Where-Object -Not support · Issue #3529 · PowerShell/PowerShell
Description: I often have the need to filter for objects that do not have a property specified or who have a falsey value for a property by doing something like the following: $Computers = [PSCustomObject]@{ ComputerName = "SPC-1234" IPAddress = "192...
Open Graph Description: I often have the need to filter for objects that do not have a property specified or who have a falsey value for a property by doing something like the following: $Computers = [PSCustomObject]@{ Co...
X Description: I often have the need to filter for objects that do not have a property specified or who have a falsey value for a property by doing something like the following: $Computers = [PSCustomObject]@{ Co...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/3529
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add Where-Object -Not support","articleBody":"I often have the need to filter for objects that do not have a property specified or who have a falsey value for a property by doing something like the following:\r\n\r\n```\r\n$Computers = [PSCustomObject]@{\r\n ComputerName = \"SPC-1234\"\r\n IPAddress = \"192.168.0.1\"\r\n},\r\n[PSCustomObject]@{\r\n ComputerName = \"BGP-5678\"\r\n IPAddress = \"\"\r\n},\r\n[PSCustomObject]@{\r\n ComputerName = \"MGC-9101\"\r\n}\r\n\r\n$Computers | \r\nWhere {-not $_.IPAddress }\r\n```\r\n```\r\nComputerName IPAddress\r\n------------ ---------\r\nBGP-5678 \r\nMGC-9101 \r\n```\r\n\r\nIf I am doing the opposite test I can avoid using a script block with Where-Object:\r\n\r\n```\r\n$Computers |\r\nWhere IPAddress\r\n```\r\n\r\n```\r\nComputerName IPAddress \r\n------------ --------- \r\nSPC-1234 192.168.0.1\r\n```\r\n\r\nI would like to be able to also avoid using a script block when using -Not which would enable the following:\r\n```\r\n$Computers | \r\nwhere -not IPAddress\r\n```","author":{"url":"https://github.com/ChrisMagnuson","@type":"Person","name":"ChrisMagnuson"},"datePublished":"2017-04-11T12:58:24.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/3529/PowerShell/issues/3529"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6cd00ec3-4e14-fdbd-e87e-6330d8d7278b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B87C:D635E:3B7839E:54641A3:6A56A3CD |
| html-safe-nonce | fedadb38432ef48519139fbabe26886e687e35c9e0537845edcae436a78ef877 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCODdDOkQ2MzVFOjNCNzgzOUU6NTQ2NDFBMzo2QTU2QTNDRCIsInZpc2l0b3JfaWQiOiI4MTM2NzM5NzY3OTQ4MDU5NTk3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | cbad35f2d1d23ecdb85bb463345c9cf563d9c08411ff6ff9d2391ca344ea3654 |
| hovercard-subject-tag | issue:220943076 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/3529/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5e8dbe6afaae7358927dec48bb607d2753d7461585f17d3ad365e81c66db82bf/PowerShell/PowerShell/issues/3529 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5e8dbe6afaae7358927dec48bb607d2753d7461585f17d3ad365e81c66db82bf/PowerShell/PowerShell/issues/3529 |
| og:image:alt | I often have the need to filter for objects that do not have a property specified or who have a falsey value for a property by doing something like the following: $Computers = [PSCustomObject]@{ Co... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ChrisMagnuson |
| hostname | github.com |
| expected-hostname | github.com |
| None | 13efe7fe8ecc41eda1078cbde8206041ed92bc54e29bcb737e9353dd9c407aad |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5466ebe023a0abf876a1e6c5d7602ee8f5e6a02b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width