So i am having trouble with powershell when trying to install or update any module

Anonymous
2024-01-16T14:34:23+00:00

I had an issue with changing the execution policy so I downloaded the PowerShell 7 zip and replaced all from it with the default install of PowerShell 5.1

now I can not install or update any module and the previous issue is not resolved until I import the older version of the execution module from system32\WindowsPowerShell\v1.0\Modules

I am pretty sure that most other commands are broken too and I haven't stumbled on them yet

Can you help me fix this issue by giving me the default modules in Win 11, PowerShell 5.1 comes with

Or is there a way to download them again
I tried using the Nuget gallery but I got this error

The term 'Install-PackageProvider' is not recognized as the name of a cmdlet, function,

script file

I do have a Package provider module tho and its commands are not recognized due to the above reason

All help is appreciated

Regards Vaibhav Behl

***Moved from Windows / Windows 11 / Files, folders, and storage***

Windows for business Windows Server User experience PowerShell

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question. To protect privacy, user profiles for migrated questions are anonymized.

0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2024-01-18T06:04:59+00:00

    Hi,

    The Install-PackageProvider cmdlet is part of the PackageManagement module which comes with PowerShell. Please first check to see if the PackageManagement module is still available.

    Get-Module PackageManagement -ListAvailable
    

    If the module is listed, try importing it manually.

    Import-Module PackageManagement
    

    If not, please reinstall PowerShell 7.

    Installing PowerShell on Windows - PowerShell | Microsoft Learn

    0 comments No comments