Commands / Help and discovery

Install-Module

Install a module from the PowerShell Gallery

intermediate Help and discovery

Install-Module
 Install-Module -Name ImportExcel -Scope CurrentUser
Works on
WindowsLinuxmacOS
PowerShell
5.1 and later
Reference
Microsoft Learn: Install-Module

Careful: Modules are code that runs as you. Install only ones you trust, and check the publisher and download count on the Gallery page first.

Modules add commands. The PowerShell Gallery is the official public catalog.

-Scope CurrentUser installs for you only and does not need an administrator prompt.

The first time, PowerShell may ask to install the NuGet provider and warn that the repository is "untrusted." Both are normal; answer Y if you trust the module.

Try this

Find-Module -Name ImportExcel
Install-Module -Name ImportExcel -Scope CurrentUser
Get-Command -Module ImportExcel

Update later with Update-Module -Name ImportExcel. Remove it with Uninstall-Module -Name ImportExcel.

PowerShell 7.4+ also ships the newer Install-PSResource (module Microsoft.PowerShell.PSResourceGet). It does the same job, but some parameters differ: for example, -TrustRepository replaces answering the "untrusted repository" prompt, and -Reinstall replaces -Force.

Related commands