René's URL Explorer Experiment


Title: Make Select-String more intelligent for non-primitive types · Issue #10726 · PowerShell/PowerShell · GitHub

Open Graph Title: Make Select-String more intelligent for non-primitive types · Issue #10726 · PowerShell/PowerShell

X Title: Make Select-String more intelligent for non-primitive types · Issue #10726 · PowerShell/PowerShell

Description: Summary of the new feature/enhancement As a user, I want to be able to easily use Select-String to find string data in formatted output, so that I can find and process data in PowerShell more quickly. By default, when you pass non-string...

Open Graph Description: Summary of the new feature/enhancement As a user, I want to be able to easily use Select-String to find string data in formatted output, so that I can find and process data in PowerShell more quick...

X Description: Summary of the new feature/enhancement As a user, I want to be able to easily use Select-String to find string data in formatted output, so that I can find and process data in PowerShell more quick...

Opengraph URL: https://github.com/PowerShell/PowerShell/issues/10726

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Make Select-String more intelligent for non-primitive types","articleBody":"# Summary of the new feature/enhancement\r\n\r\nAs a user,\r\nI want to be able to easily use `Select-String` to find string data in formatted output,\r\nso that I can find and process data in PowerShell more quickly.\r\n\r\nBy default, when you pass non-string data into the `Select-String` cmdlet, it will find matches based on the object's `ToString()` method results. This is great when the `ToString` output actually represents the data you want to match, but very often `ToString` results do not represent the data that you see in PowerShell, and this can result in incorrect or failed matches.\r\n\r\nFor example, consider this script:\r\n\r\n```powershell\r\n# First, capture the date:\r\n$date = Get-Date\r\n\r\n# Now, get the current month in string format:\r\n$month = $date.ToString(\"MMMM\")\r\n\r\n# Now, look at how the date renders in PowerShell, showing the month as a string\r\n$date\r\n\r\n# Now, try to match the month using Select-String. This returns nothing.\r\nGet-Date | Select-String -Pattern $month\r\n```\r\n\r\nThat script shows the current date, including the month in string format, but if you try to select that string based on the actual string month, there are no matches. Why does this happen? Because `ToString()` on `DateTime` objects returns the date time with a numeric month, not the string month.\r\n\r\nNow let's look at a more realistic example:\r\n\r\n```powershell\r\n# Get some services, including the Windows Update service, and filter output on the\r\n# string \"Update\"\r\nGet-Service wuauserv,bits | Select-String Update\r\n```\r\n\r\nThat returns nothing. Why? Because the `ToString` method on service objects returns the name of service, so you can't filter output based on a partial match of a display name string this way.\r\n\r\nHere is one more example:\r\n\r\n```powershell\r\nGet-Process -Id $PID | Format-List * | Select-String Memory\r\n```\r\n\r\nThis also returns nothing, because of the `ToString` method on `Format` cmdlet output objects returns their type name, none of which match `Memory`.\r\n\r\n_It is reasonable for a user to expect to be able to easily and consistently parse/filter output that is rendered in the PowerShell console, but this is not possible unless they pipe to `Out-String -Stream` before they then pipe that streamed result to `Select-String`._\r\n\r\n# Proposed technical implementation details (optional)\r\n\r\n[EDIT]: Updated to reflect the parameter name we decided to move forward in the discussion below.\r\n\r\nI want to make `Select-String` better by adding a new ~~`-ConsoleOutput` switch parameter (or some better parameter name: suggestions welcome)~~ `-FromFormattedOutput` switch parameter that indicates that you want to select a string based on the console output of the data that is piped into `Select-String`, which would automatically take care of the formatting and output of non-value and non-string types (and non-MatchInfo, but that's a special case internally for `Select-String`), and select string matches based on that output rather than based on the `ToString` method output of individual objects.\r\n\r\n# Additional details\r\n\r\nPersonally I would prefer if Select-String worked this way by default for non-value and non-string types, but that would be a breaking change at this point, so that's not an option; however, users who want it to work this way by default can use `$PSDefaultParameterValues['Select-String:FromFormattedOutput'] = $true`, and that will have the same result.\r\n","author":{"url":"https://github.com/KirkMunro","@type":"Person","name":"KirkMunro"},"datePublished":"2019-10-07T23:57:34Z","url":"https://github.com/PowerShell/PowerShell/issues/10726"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:5eb099ba-c8f2-339f-af67-bf9eb72d83d3
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE6EA:1790B5:1F065C:29C647:6AFD448D
html-safe-noncea879af998c06e5fd04b568b450bbf2f32372b479a019273c3980e119477ac848
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNkVBOjE3OTBCNToxRjA2NUM6MjlDNjQ3OjZBRkQ0NDhEIiwidmlzaXRvcl9pZCI6Ijg1MTQ5ODM2NTIwODg0MzE3NTciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac0efb46590af13b551cd3c07eb43b18a0c766c83f6f857d214bb18c5d4d031afb
hovercard-subject-tagissue:503750984
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/10726/issue_layout
twitter:imagehttps://opengraph.githubassets.com/063883ac7c5cce3da8eed8f6c97699047fcef96660e0a5d944327ba6e7d14009/PowerShell/PowerShell/issues/10726
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/063883ac7c5cce3da8eed8f6c97699047fcef96660e0a5d944327ba6e7d14009/PowerShell/PowerShell/issues/10726
og:image:altSummary of the new feature/enhancement As a user, I want to be able to easily use Select-String to find string data in formatted output, so that I can find and process data in PowerShell more quick...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameKirkMunro
hostnamegithub.com
expected-hostnamegithub.com
Nonebdbacc25b921224ff0befcb9e629560a1255be51aec9991d6e3f95b5e9151474
turbo-cache-controlno-preview
go-importgithub.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git
octolytics-dimension-user_id11524380
octolytics-dimension-user_loginPowerShell
octolytics-dimension-repository_id49609581
octolytics-dimension-repository_nwoPowerShell/PowerShell
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id49609581
octolytics-dimension-repository_network_root_nwoPowerShell/PowerShell
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release556dd37bb0aceffb25724e151b5d858b3265b40b
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/PowerShell/PowerShell/issues/10726#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F10726
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FPowerShell%2FPowerShell%2Fissues%2F10726
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=PowerShell%2FPowerShell
Reloadhttps://github.com/PowerShell/PowerShell/issues/10726
Reloadhttps://github.com/PowerShell/PowerShell/issues/10726
Reloadhttps://github.com/PowerShell/PowerShell/issues/10726
PowerShellhttps://github.com/PowerShell
PowerShellhttps://github.com/PowerShell/PowerShell
Codehttps://github.com/PowerShell/PowerShell
Issues1.3k (1.3k)https://github.com/PowerShell/PowerShell/issues
Pull requests365 (365)https://github.com/PowerShell/PowerShell/pulls
Discussionshttps://github.com/PowerShell/PowerShell/discussions
Actionshttps://github.com/PowerShell/PowerShell/actions
Projectshttps://github.com/PowerShell/PowerShell/projects
Security and quality3 (3)https://github.com/PowerShell/PowerShell/security
Insightshttps://github.com/PowerShell/PowerShell/insights
https://github.com/PowerShell/PowerShell
New issuehttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/10726
New issuehttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/10726
Make Select-String more intelligent for non-primitive typeshttps://github.com/PowerShell/PowerShell/issues/10726#top
Committee-ReviewedPS-Committee has reviewed this and made a decisionhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Committee-Reviewed%22
Issue-Enhancementthe issue is more of a feature request than a bughttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Enhancement%22
Resolution-No ActivityIssue has had no activity for 6 months or morehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-No%20Activity%22
Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorshttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Up-for-Grabs%22
https://github.com/KirkMunro
Kirk Munro (KirkMunro)https://github.com/KirkMunro
on Oct 7, 2019https://github.com/PowerShell/PowerShell/issues/10726#issue-503750984
Nexthttps://github.com/PowerShell/PowerShell/issues/10726?timeline_page=1
Kirk Munro (KirkMunro)https://github.com/KirkMunro
Issue-Enhancementthe issue is more of a feature request than a bughttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Enhancement%22
on Oct 7, 2019https://github.com/PowerShell/PowerShell/issues/10726#event-2693657753
https://github.com/iSazonov
Ilya (iSazonov)https://github.com/iSazonov
on Oct 8, 2019https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-539370273
https://github.com/mklement0
Michael Klement (mklement0)https://github.com/mklement0
on Oct 8, 2019https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-539525220
Ilya (@iSazonov)https://github.com/iSazonov
https://github.com/vexx32
Rain Sallow (/u/ta11ow) (vexx32)https://github.com/vexx32
on Oct 8, 2019https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-539530394
https://github.com/mklement0
Michael Klement (mklement0)https://github.com/mklement0
on Oct 8, 2019https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-539533811
https://github.com/mklement0
Michael Klement (mklement0)https://github.com/mklement0
on Oct 8, 2019https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-539534837
Rain Sallow (/u/ta11ow) (@vexx32)https://github.com/vexx32
https://github.com/KirkMunro
Kirk Munro (KirkMunro)https://github.com/KirkMunro
on Oct 8, 2019https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-539544709
Michael Klement (@mklement0)https://github.com/mklement0
https://github.com/vexx32
Rain Sallow (/u/ta11ow) (vexx32)https://github.com/vexx32
on Oct 8, 2019https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-539545167
mklementhttps://github.com/mklement
https://github.com/KirkMunro
Kirk Munro (KirkMunro)https://github.com/KirkMunro
on Oct 8, 2019https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-539546448
Rain Sallow (/u/ta11ow) (@vexx32)https://github.com/vexx32
https://user-images.githubusercontent.com/3515485/66405466-8ff98d80-e9c0-11e9-896f-6db53a62d96c.png
https://github.com/vexx32
Rain Sallow (/u/ta11ow) (vexx32)https://github.com/vexx32
on Oct 8, 2019https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-539547258
Kirk Munro (@KirkMunro)https://github.com/KirkMunro
https://github.com/KirkMunro
Kirk Munro (KirkMunro)https://github.com/KirkMunro
on Oct 8, 2019https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-539547323
Rain Sallow (/u/ta11ow) (@vexx32)https://github.com/vexx32
https://user-images.githubusercontent.com/3515485/66405634-cb945780-e9c0-11e9-87ed-eb031870e739.png
https://github.com/KirkMunro
Kirk Munro (KirkMunro)https://github.com/KirkMunro
on Oct 8, 2019https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-539549721
https://github.com/vexx32
Rain Sallow (/u/ta11ow) (vexx32)https://github.com/vexx32
on Oct 8, 2019https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-539562683
https://github.com/KirkMunro
Kirk Munro (KirkMunro)https://github.com/KirkMunro
on Oct 9, 2019https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-540052708
#8963https://github.com/PowerShell/PowerShell/pull/8963
https://github.com/mklement0
Michael Klement (mklement0)https://github.com/mklement0
on Oct 9, 2019https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-540149250
Rain Sallow (/u/ta11ow) (@vexx32)https://github.com/vexx32
Kirk Munro (@KirkMunro)https://github.com/KirkMunro
https://github.com/vexx32
Rain Sallow (/u/ta11ow) (vexx32)https://github.com/vexx32
on Dec 19, 2019https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-567323912
Joey Aiello (@joeyaiello)https://github.com/joeyaiello
https://github.com/bpayette
Bruce Payette (bpayette)https://github.com/bpayette
on Dec 19, 2019https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-567591175
Kirk Munro (@KirkMunro)https://github.com/KirkMunro
Michael Klement (@mklement0)https://github.com/mklement0
https://github.com/KirkMunro
Kirk Munro (KirkMunro)https://github.com/KirkMunro
on Dec 19, 2019https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-567601661
Bruce Payette (@bpayette)https://github.com/bpayette
Steve Lee (@SteveL-MSFT)https://github.com/SteveL-MSFT
https://github.com/mklement0
Michael Klement (mklement0)https://github.com/mklement0
on Dec 19, 2019https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-567628146
Rain Sallow (/u/ta11ow) (@vexx32)https://github.com/vexx32
Kirk Munro (@KirkMunro)https://github.com/KirkMunro
Kirk Munro (@KirkMunro)https://github.com/KirkMunro
Joey Aiello (@joeyaiello)https://github.com/joeyaiello
https://github.com/mklement0
Michael Klement (mklement0)https://github.com/mklement0
on Nov 1, 2020https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-720115254
Gisthttps://gist.github.com/mklement0/46fea9e6e5ef1a3ceaf681c976cb68e3
this SO answerhttps://stackoverflow.com/a/64633140/45375
https://github.com/FireInWinter
FireInWinterhttps://github.com/FireInWinter
on Nov 10, 2021https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-965808595
https://github.com/mklement0
Michael Klement (mklement0)https://github.com/mklement0
on Nov 10, 2021https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-965810932
FireInWinterhttps://github.com/FireInWinter
https://github.com/apps/microsoft-github-policy-service
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
on Nov 16, 2023https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-1813784187
Microsoft GitHub Policy Servicehttps://aka.ms/1es-gitops
https://github.com/apps/microsoft-github-policy-service
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
on Nov 16, 2023https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-1813784189
Microsoft GitHub Policy Servicehttps://aka.ms/1es-gitops
https://github.com/apps/microsoft-github-policy-service
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
on Nov 16, 2023https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-1813784190
Microsoft GitHub Policy Servicehttps://aka.ms/1es-gitops
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
Resolution-No ActivityIssue has had no activity for 6 months or morehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-No%20Activity%22
on Nov 16, 2023https://github.com/PowerShell/PowerShell/issues/10726#event-10975607162
https://github.com/apps/microsoft-github-policy-service
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
on Nov 23, 2023https://github.com/PowerShell/PowerShell/issues/10726#issuecomment-1824325892
Microsoft GitHub Policy Servicehttps://aka.ms/1es-gitops
microsoft-github-policy-servicehttps://github.com/apps/microsoft-github-policy-service
completedhttps://github.com/PowerShell/PowerShell/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Nov 23, 2023https://github.com/PowerShell/PowerShell/issues/10726#event-11046911101
Sign up for freehttps://github.com/signup?return_to=https://github.com/PowerShell/PowerShell/issues/10726
Sign in to commenthttps://github.com/login?return_to=https://github.com/PowerShell/PowerShell/issues/10726
Committee-ReviewedPS-Committee has reviewed this and made a decisionhttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Committee-Reviewed%22
Issue-Enhancementthe issue is more of a feature request than a bughttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Issue-Enhancement%22
Resolution-No ActivityIssue has had no activity for 6 months or morehttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Resolution-No%20Activity%22
Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorshttps://github.com/PowerShell/PowerShell/issues?q=state%3Aopen%20label%3A%22Up-for-Grabs%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.