Wilson Mar bio photo

Wilson Mar

Hello!

Calendar YouTube Github

LinkedIn

Share scripting functions with others

US (English)   Norsk (Norwegian)   Español (Spanish)   Français (French)   Deutsch (German)   Italiano   Português   Estonian   اَلْعَرَبِيَّةُ (Egypt Arabic)   Napali   中文 (简体) Chinese (Simplified)   日本語 Japanese   한국어 Korean

Overview

PowerShellGallery

CAUTION: An issue exists on Mac where module install requires elevated root priviledges. So no Install-Module on Mac after loading Powershell with:

sudo -s

(sudo powershell isn’t enough)

The Most downloaded module in the
https://www.powershellgallery.com is PSDscResources (from Micorosoft’s PowerShellTeam) which provides standard DSC resources.

Carbon automates configuration Windows 7, 8, 2008, and 2012 and automation the installation and configuration of Windows applications, websites, and services.

With the PowerShellGet package management module, you can:

Rather than an alphabetical list of modules at https://www.powershellgallery.com (which lists counts), below here are tables with right-align for easy comparison:

- Module Script
Search Find-Module Find-Script
- Install-Module Install-Script
- Uninstall-Module Uninstall-Script
- Get-InstalledModule Get-InstalledScript
Upload Publish-Module Publish-Script
Save Save-Module Save-Script
- Update-Module Update-Script

Metadata:

- Module Script
- Update-ModuleManifest Update-ScriptFileInfo
- - Find-ScriptFileInfo
- - New-ScriptFileInfo
- - Test-ScriptFileInfo

QUESTION: Modules with a single action:

- Singles
- Find-Command
- Find-DscResource
- Find-RoleCapability
- Get-PSRepository
- Set-PSRepository
Add your own Register-PSRepository
- Unregister-PSRepository

Documentation

The documentation mentions only Windows and not Mac OS.

  1. BLAH: Install local help for these commands is denied:

    Update-Help -Module PowerShellGet

    PowerShellGet based on Microsoft’s OneGet core for package management.

    https://github.com/juanpablojofre/PowerShell-Doc-Utilities

Avoid truncation with ellipsis

Based on this, this, and this.

  1. To keep collections from being truncated and replace with “…” (ellipsis) like this:

    {Add-Content, Clear-Content, Clear-ItemProperty, Join-Path...}

    
    $FormatEnumerationLimit=-1
    

    TODO: Make this happen on every terminal instantiation.

List modules available


   Get-Module -ListAvailable | out-string -Width 300
   

| out-string -Width 170 expands the terminal buffer to avoid having output truncated and replace with “…” (ellipsis).

The response lists modules supplied natively before custom modules are added.

    Directory: /usr/local/microsoft/powershell/6.0.0-alpha.12/Modules
 
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   1.0.1.0    Microsoft.PowerShell.Archive        {Compress-Archive, Expand-Archive}                                                                              
Manifest   3.0.0.0    Microsoft.PowerShell.Host           {Start-Transcript, Stop-Transcript}                                                                             
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-ItemProperty, Join-Path...}                                                  
Manifest   3.0.0.0    Microsoft.PowerShell.Security       {Get-Credential, Get-ExecutionPolicy, Set-ExecutionPolicy, ConvertFrom-SecureString...}                         
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Format-List, Format-Custom, Format-Table, Format-Wide...}                                                      
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}                                          
Script     3.3.9      Pester                              {Describe, Context, It, Should...}                                                                              
Script     1.1.0.0    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}                                                    
Script     0.0        PSDesiredStateConfiguration         {StrongConnect, IsHiddenResource, Write-MetaConfigFile, Get-InnerMostErrorRecord...}                            
Script     1.2        PSReadLine                          {Get-PSReadlineKeyHandler, Set-PSReadlineKeyHandler, Remove-PSReadlineKeyHandler, Get-PSReadlineOption...}      
   

QUESTION: How to exclude from list Manifest and system built-in items?

Where are they stored?

Such system modules are stored in an environment variable revealed by this:

$Env:PSModulePath

Custom modules that you write go into path

$home\Documents\WindowsPowerShell\Modules\


   Get-Module -ListAvailable | out-string -Width 300
   

References

https://github.com/garignack/InfosecPosh101

More on API Microservices

This is one of a series: