workflow Download-AllGalleryModules
{
mkdir C:\modules
mkdir C:\scripts
$modules = Find-Module * -IncludeDependencies | Sort-Object Name
$scripts = Find-Script * -IncludeDependencies | Sort-Object Name
foreach -parallel -throttlelimit 25 ($module in $modules)
{
Try
{
Save-Module $module.Name -Path "C:\modules" -Force -ErrorAction Stop
}
Catch
{
Save-module $module.Name -Path "C:\modules" -Force -AllowClobber
}
}
foreach -parallel -throttlelimit 25 ($script in $scripts)
{
Save-Script $script.Name -Path "C:\scripts" -Force
}
}