Install-Module : Administrator rights are required to install modules in ‘C:\Program files\WindowsPowerShell\Modules’.

Problem: When trying to install a PowerShell module, got an error message “Install-Module: Administrator rights are required to install modules in ‘C:\Program Files\WindowsPowershell\Modules’ Log on to the computer with an account that has Administrator rights, and then try again, or install ” by adding “-Scope Current User” to your command. You can also try running the Windows PowerShell session with elevated rights (Run as Administrator).”

Solution:

Apparently, the PowerShell modules must be installed with the Install-Module cmdlet by running the PowerShell console as Administrator. To resolve the problem, we have two choices:

  1. Run the PowerShell console by right-clicking on the PowerShell console and choosing “Run as Administrator” and then use Install-Module cmdlet.
  2. If you don’t have administrator rights, add the “-Scope CurrentUser” switch to the Install-module cmdlet. E.g. “Install-Module AzureADPreview -Scope CurrentUser”
install-module administrator rights are required to install module in c-programfiles-windowspowershell-modules

When you use Install-Module with -Scope CurrentUser, it installs the module in the “%USERPROFILE%\Documents\WindowsPowerShell\Modules” folder. You may have to add this path to the “PSModulePath” environment variable to use the cmdlets anywhere.

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. Passionate about sharing the deep technical knowledge and experience to help others, through the real-world articles!

Leave a Reply

Your email address will not be published. Required fields are marked *