Can't install oh-my-posh, although I am an admin user?

after configuring my PowerShell and installing Starship.rs, I wanted to install oh-my-posh. The instruction on the website for this is Install-Module oh-my-posh -Scope CurrentUser. I tried this but I get this error every time:

Administrator rights are required to install or update. Log on to the computer with an account that has Administrator rights, and then try again, or install by adding "-Scope CurrentUser" to your command. You can also try running the Windows PowerShell session with elevated rights (Run as Administrator).

I tried these things:

  • Run PowerShell as an Admin by right clicking the application, selecting the option and accepting the prompt
  • Change the command to this Install-Module -Scope CurrentUser oh-my-posh

But this didn't work neither. How can I install oh-my-posh now?

Some Information:

  • I am running Windows 11 Beta on a Surface Pro 7
  • I am running PowerShell 7.1.5

after configuring my PowerShell and installing Starship.rs, I wanted to install oh-my-posh. The instruction on the website for this is Install-Module oh-my-posh -Scope CurrentUser. I tried this but I get this error every time:

I suspect the issue is due to a combination of needing to tweak Controlled Folder Access by adding an exception for pwsh.exe and the fact your profile is linked to your OneDrive folder. If you don’t want to bother with tweaking Controlled Folder Access you can simply disable it.

It also appears that this solution can be solved by NOT using the Windows Store to install PowerShell. Be sure to use the current .MSI installer instead.

Source: Falsely throws exception as 'Administrator rights required' when running already as an admin - Install-Module #586