Last active
August 10, 2024 22:47
-
-
Save markwragg/831afb7d3fd61a0338f851f4190761df to your computer and use it in GitHub Desktop.
Find PowerShell modules for a specified author and return download count, description, URI and published date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Find-ModuleByAttribute { | |
[cmdletbinding()] | |
param( | |
$Attribute = 'companyname', | |
$Value = 'markwragg' | |
) | |
Write-Verbose "Finding all modules where $Attribute = $Value.." | |
$Modules = Find-Module | Where-Object { $_.$Attribute -eq $Value } | |
foreach ($Module in $Modules) { | |
Write-Verbose "Finding all versions of $($Module.Name).." | |
$ModuleVersions = Find-Module -Name $Module.Name -AllVersions | |
$FirstPublishedDate = ($ModuleVersions | Sort-Object { $_.Version -as [version] } | Select -First 1).PublishedDate | |
$DownloadCount = [int]($ModuleVersions.AdditionalMetadata.versionDownloadCount | Measure-Object -Sum).Sum | |
[PSCustomObject]@{ | |
Name = $Module.Name | |
DownloadCount = $DownloadCount | |
Description = $Module.Description | |
ProjectUri = $Module.ProjectUri | |
FirstPublishedDate = $FirstPublishedDate | |
LastPublishedDate = $Module.PublishedDate | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment