Skip to content

Fast method for checking if a version of a package is installed. #1226

@AlexisColes

Description

@AlexisColes

Hi there,

Please let me know if I am missing something but i am using the following powershell to check to see if a package is installed or not.

choco list -lo | Where-object { $_.ToLower().StartsWith("SomeName".ToLower()) }
if($result -ne $null){
$parts = $result.Split(' ');
	return $parts[1] -eq $this.Version;
}
return $false;

However "choco list -lo" is taking 2-3 seconds to give me a list of about 5 installed packages.

This is quite a long time if I want to check many packages on many servers and I am not sure why it needs to take so long. Is it possible to add a better function for checking if a particular version of a package is installed that returns in less that 50ms?

Cheers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    0 - BacklogIssue is accepted, but is not ready to be worked on or not in current sprint.EnhancementIssues that introduce new functionality to the project, or enhances/updates existing functionality.Priority - LowRepresents issues that are of lower priority, can be taken care of whenever.Up For GrabsIssues that are available by the community to work on.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions