Skip to main content

PowerShell command examples to discover, install, update and publish PowerShell artifacts, and from the online PowerShell Gallery.

---
title: PowerShellGet Commands
subtitle: "PowerShell command examples to discover, install, update and publish PowerShell artifacts, and from the online PowerShell Gallery"
author: Jon LaBelle
date: June 1, 2019
source: https://jonlabelle.com/snippets/view/markdown/powershellget-commands
notoc: false
---

> *PowerShellGet is a module with commands for discovering, installing, updating
> and publishing PowerShell artifacts like Modules, DSC Resources, Role
> Capabilities, and Scripts.* --- [PowerShellGet](https://docs.microsoft.com/en-us/powershell/module/powershellget/)

## Modules

### Searching

The [Find-Module](https://docs.microsoft.com/en-us/powershell/module/powershellget/find-module)
finds modules in a repository that match specified criteria.

#### Examples

**To find a module by name:**

```powershell
Find-Module -Name <module_name>
```

**To find modules with similar name:**

```powershell
Find-Module -Name <some_name>*
```

**To find a module by minimum version:**

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

**To find a module by specific version:**

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

**To find a module in a specific repository:**

```powershell
Find-Module -Name <module_name> -Repository PSGallery
```

**To find a module that contains a [DSC](https://docs.microsoft.com/en-us/powershell/dsc/resources/resources) resource:**

```powershell
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.

```powershell
Find-Module -Filter <argument>
```

### Installing

The [Install-Module](https://docs.microsoft.com/en-us/powershell/module/powershellget/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:**

```powershell
Install-Module -Name <module_name>
```

**To install a specific version of a module:**

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

**To install a module only for the current user:**

```powershell
Install-Module -Name <module_name> -Scope CurrentUser
```

**To install a module for all users:**

```powershell
Install-Module -Name <module_name> -Scope AllUsers
```

### Updating

The [Update-Module](https://docs.microsoft.com/en-us/powershell/module/powershellget/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].

```powershell
Update-Module
```

**To update a module by name:**

```powershell
Update-Module -Name <module_name>
```

**To update a module to a specified version:**

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

**To update a module regardless of the current version installed:**

```powershell
Update-Module -Name <module_name> -Force
```

### Uninstalling

The [Uninstall-Module](https://docs.microsoft.com/en-us/powershell/module/powershellget/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:**

```powershell
Uninstall-Module -Name <module_name>
```

### Listing

[Get-InstalledModule](https://docs.microsoft.com/en-us/powershell/module/powershellget/get-installedmodule)
gets installed modules on a computer.

#### Examples

**To show a list of all installed modules:**

```powershell
Get-InstalledModule
```

## Additional Resources

- [**PowerShell Gallery**](https://www.powershellgallery.com) -- The central repository for sharing and acquiring PowerShell code including PowerShell modules, scripts, and DSC resources.
- [**Documentation for All PowerShellGet Commands**](https://docs.microsoft.com/en-us/powershell/module/powershellget/) -- Complete and official documentation for all PowerShellGet commands.

[online gallery]: https://www.powershellgallery.com