FolderRisk: Do not touch
Modules C:\Windows\System32\WindowsPowerShell\v1.0\Modules
PowerShell modules shipped with Windows (Management, Utility, Security...) and those of roles and RSAT (ActiveDirectory, Hyper-V, DnsServer); $PSHOME\Modules.
What it’s for
Windows PowerShell 5.1 modules installed with the operating system, in $PSHOME\Modules. When you install a role or feature (or the RSAT tools), its module lands here: ActiveDirectory, Hyper-V, DnsServer, DhcpServer, NetTCPIP, Storage… It is the last folder of $env:PSModulePath for Windows PowerShell, after the user profile and Program Files.
What it contains
- One subfolder per module (
Microsoft.PowerShell.Management,Microsoft.PowerShell.Utility,Microsoft.PowerShell.Security…), each with a.psd1manifest and its module. - The modules of the roles and features enabled on the machine: their presence tells you whether the role or RSAT is installed.
Risks and best practices
- Do not drop your own modules here: the folder belongs to Windows and is serviced with it. Put them in
C:\Program Files\WindowsPowerShell\Modules, or in the user profile. - A module missing while the feature is installed is fixed by adding the feature (
Install-WindowsFeatureon a server,Add-WindowsCapabilityfor RSAT on a client), not by copying files. - PowerShell 7 reads this folder for compatibility, but some Windows PowerShell modules must be loaded through the compatibility layer.
Useful commands
# Modules shipped with the system (not the ones you installed)Get-Module -ListAvailable | Where-Object ModuleBase -like "$PSHOME\Modules*" | Select-Object Name, Version
# Is a role module present?Get-Module -ListAvailable ActiveDirectory
# Missing role or feature (Windows Server)Get-WindowsFeature RSAT-AD-PowerShell