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

Why not use Get-CMApplication -Name for Get-AppList.ps1? #13

Closed
obuolinis opened this issue Nov 25, 2023 · 7 comments
Closed

Why not use Get-CMApplication -Name for Get-AppList.ps1? #13

obuolinis opened this issue Nov 25, 2023 · 7 comments

Comments

@obuolinis
Copy link

Ben, why are you retrieving the whole list of CM apps and then do filtering by name on the client side when you can make use of the "Name" parameter of Get-CMApplication supporting wildcards and let the server do the filtering?

My environment (300+ apps):

  • 3-4s for $apps = Get-CMApplication -Fast | Where-Object { $_.LocalizedDisplayName -like "*java*" }
  • <1s for $apps = Get-CMApplication -Name "*java*" -Fast
@byteben
Copy link
Owner

byteben commented Nov 25, 2023

What is the speed difference when using the -fast switch in your environment between the 2 commands?

@obuolinis
Copy link
Author

But I already used -Fast above... Or you mean with and without -Fast?

  • $apps = Get-CMApplication | Where-Object { $_.LocalizedDisplayName -like "*java*" }
    this takes insanely long
  • $apps = Get-CMApplication -Name "*java*"
    this completes in 1-1.5s

@byteben
Copy link
Owner

byteben commented Nov 25, 2023

When you say insanely long, what do you mean? In your first comment you indicated it took 3-4 seconds?

@obuolinis
Copy link
Author

Ben, my first measurement/comment included -Fast parameter, my second one didn't :)

@byteben
Copy link
Owner

byteben commented Nov 25, 2023

Which function/line are you referring to please?

@obuolinis
Copy link
Author

$applicationResult = Get-CMApplication -Fast | Where-Object { $_.LocalizedDisplayName -like "$AppName" -and (-not ($_.LocalizedDisplayName -like "$ExcludeFilter") ) -and (-not ($_.LocalizedDescription -like "$Pmpc_Comment") ) } | Select-Object @{ Name = 'Id'; Expression = { $_.CI_ID.toString() } }, LocalizedDisplayName, HasContent, NumberOfDeploymentTypes, IsDeployable, IsDeployed, DateCreated, DateLastModified, LastModifiedBy | Sort-Object LocalizedDisplayName

This and all the other "Get-CMApplication -Fast" references in the same file.

@byteben
Copy link
Owner

byteben commented Nov 25, 2023

Consideration accepted, thank you
Merged #14

@byteben byteben closed this as completed Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants