Skip to content

Instantly share code, notes, and snippets.

@jonlabelle
Last active February 26, 2021 10:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jonlabelle/10824b751aac1e4ead9fafcc00d47bd4 to your computer and use it in GitHub Desktop.
Save jonlabelle/10824b751aac1e4ead9fafcc00d47bd4 to your computer and use it in GitHub Desktop.
PowerShellGet Commands
title subtitle author date source notoc
PowerShellGet Commands
PowerShell command examples to discover, install, update and publish PowerShell artifacts, and from the online PowerShell Gallery
Jon LaBelle
June 1, 2019
false

PowerShellGet is a module with commands for discovering, installing, updating and publishing PowerShell artifacts like Modules, DSC Resources, Role Capabilities, and Scripts. --- PowerShellGet

Modules

Searching

The Find-Module finds modules in a repository that match specified criteria.

Examples

To find a module by name:

Find-Module -Name <module_name>

To find modules with similar name:

Find-Module -Name <some_name>*

To find a module by minimum version:

Find-Module -Name <module_name> -MinimumVersion <min_version_number>

To find a module by specific version:

Find-Module -Name <module_name> -RequiredVersion <version_number>

To find a module in a specific repository:

Find-Module -Name <module_name> -Repository PSGallery

To find a module that contains a DSC resource:

Find-Module -Repository PSGallery -Includes DscResource

To find a module using a filter:

The Filter parameter searches through the name, description, and tags for the specified argument.

Find-Module -Filter <argument>

Installing

The Install-Module downloads one or more modules from a repository, and installs them on the local computer.

Examples

To install the latest version of a module by name:

Install-Module -Name <module_name>

To install a specific version of a module:

Install-Module -Name <module_name> -RequiredVersion <version_number>

To install a module only for the current user:

Install-Module -Name <module_name> -Scope CurrentUser

To install a module for all users:

Install-Module -Name <module_name> -Scope AllUsers

Updating

The Update-Module downloads and installs the newest version of specified modules from an online gallery to the local computer.

Examples

To update all modules:

This example updates to the newest version all modules in $env:PSModulePath that were installed by Install-Module from the online gallery.

Update-Module

To update a module by name:

Update-Module -Name <module_name>

To update a module to a specified version:

Update-Module -Name <module_name> -RequiredVersion <version_number>

To update a module regardless of the current version installed:

Update-Module -Name <module_name> -Force

Uninstalling

The Uninstall-Module cmdlet uninstalls the specified module from the local computer. You cannot uninstall a module if it has other modules as dependencies.

Examples

To uninstall a module by name:

Uninstall-Module -Name <module_name>

Listing

Get-InstalledModule gets installed modules on a computer.

Examples

To show a list of all installed modules:

Get-InstalledModule

Additional Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment