Skip to contentGo to the directory tree
  1. C:
  2. Program Files
  3. WindowsPowerShell\Modules
FolderRisk: Caution

WindowsPowerShell\Modules C:\Program Files\WindowsPowerShell\Modules

PowerShell modules installed for all users (Install-Module -Scope AllUsers); the recommended location for your own Windows PowerShell modules.

Updated on By AltF4 Formation

What it’s for

PowerShell modules installed for every user of the machine. Install-Module -Scope AllUsers puts the module here, and it is the recommended place to copy your own company modules: the path is in $env:PSModulePath for Windows PowerShell and for PowerShell 7, without touching Windows folders.

What it contains

  • One folder per module and, inside it, one folder per version (<Module>\<Version>\<Module>.psd1), so several versions can sit side by side.
  • Modules installed from the PowerShell Gallery or an internal repository, or copied by hand.
  • Per-user modules (-Scope CurrentUser) are not here: they go to Documents\WindowsPowerShell\Modules.

Risks and best practices

  • A module from this folder runs with the rights of whoever imports it: on a server, restrict write access to administrators, which is the default, and sign internal modules.
  • On a server without Internet access, download the module on a connected machine with Save-Module, then copy the folder here, keeping the version folder structure.
  • Keep track of what is installed (Get-InstalledModule): an update can bring in a version that breaks a script, so pin the version with -RequiredVersion.

Useful commands

Fenêtre de terminal
# Modules installed by PowerShellGet
Get-InstalledModule
# Modules present in this folder
Get-Module -ListAvailable | Where-Object Path -like 'C:\Program Files\WindowsPowerShell\Modules*' | Select-Object Name, Version
# Prepare a module for an offline server
Save-Module -Name Pester -Path C:\Temp\Modules
# Uninstall all versions of a module (as administrator)
Uninstall-Module -Name Pester -AllVersions -WhatIf

Report a mistake