Skip to content

Get-DbaRegServer - Name/ServerName Support Wildcards #8043

@mattcargile

Description

@mattcargile

Summarize Functionality

It would be convenient to write the below:

Get-DbaRegServer CMS -Name '*serv*', '*ws1'

instead of

Get-DbaRegServer CMS | Where-Object { $_.Name -like '*serv*' -or $_.Name -like '*ws1' }

Is there a command that is similiar or close to what you are looking for?

No

Technical Details

I've explored the web and found the [SupportsWildCards()] attribute which should alert the user to the new support in the help.

It didn't seem straightforward on how to implement. The current implementation uses -in and I guess to support an array of wildcards one would have to rewrite as a foreach or the like.

https://github.com/sqlcollaborative/dbatools/blob/73e3e8255778983718d9df05acb1d14d69f06af0/functions/Get-DbaRegServer.ps1#L202-L210

I also read through the Supporting Wildcard Expansion article which provided insight into System.Management.Automation.Wildcardpattern and System.Management.Automation.Wildcardoptions libraries. I assume these would provide native support for the descriptions in the Supporting Wildcard Characters in Cmdlet Parameters article. I'm not exactly sure how these would be implemented in the current build of the function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featuretriage requiredNew issue that has not been reviewed by maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions