Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get-JobList -JobFilter Doesn't Handle Multiple Wildcarded Items Correctly #9572

Open
mattcargile opened this issue Jan 7, 2025 · 0 comments
Labels
bugs life triage required New issue that has not been reviewed by maintainers

Comments

@mattcargile
Copy link
Contributor

Verified issue does not already exist?

I have searched and found no existing issue

What error did you receive?

No Error. Usage like Find-DbaAgentJob -JobName filter*, filter2* does not return any items unless your Agent Jobs have the asterisks in their name. This impacts cmdlets like Find-DbaAgentJob.

Steps to Reproduce

$sqli = 'sqli'
New-DbaAgentJob -SqlInstance  $sqli -Job 'FilteredJob'
Find-DbaAgentJob -SqlInstance $sqli -JobName filter*,filter2*

Please confirm that you are running the most recent version of dbatools

2.1.26

Other details or mentions

Latest development branch shows this issue.

if ($JobFilter.Count -gt 1) {
if ($Not) {
$jobs | Where-Object Name -NotIn $JobFilter
} else {
$jobs | Where-Object Name -In $JobFilter
}

A loop would be required or a piped -like to handle multi-wildcards.

What PowerShell host was used when producing this error

PowerShell Core (pwsh.exe)

PowerShell Host Version

Name                           Value
----                           -----
PSVersion                      7.4.6
PSEdition                      Core
GitCommitId                    7.4.6
OS                             Microsoft Windows 10.0.22631
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

SQL Server Edition and Build number

Microsoft SQL Server 2017 (RTM-CU20) (KB4541283) - 14.0.3294.2 (X64) 
	Mar 13 2020 14:53:45 
	Copyright (C) 2017 Microsoft Corporation
	Standard Edition (64-bit) on Windows Server 2012 R2 Standard 6.3 <X64> (Build 9600: ) (Hypervisor)

.NET Framework Version

.NET 8.0.10
@mattcargile mattcargile added bugs life triage required New issue that has not been reviewed by maintainers labels Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugs life triage required New issue that has not been reviewed by maintainers
Projects
None yet
Development

No branches or pull requests

1 participant