Need to repair the windows powershell 5.1 to fix basic cmdlets that were deleted accidently

Anonymous
2021-12-09T04:38:27+00:00

I am using Windows 10 Enterprise Version 1909 (OS Build 18363.1916) with per-installed Windows PowerShell.

> $PSVersionTable

Name Value


PSVersion 5.1.18362.1801
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.18362.1801
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

I accidentally deleted some folders for cmdlet from inbuilt PowerShell.

Now when I run Install-Module or any other package management related cmdlet, I get error that it is not a recognized cmdlet.

I have tried removing PowerShell engine from windows optional features, restarting system and then reinstalling it again, with no luck.

Even found some community portal suggesting to remove .Net framework and reinstall, which is not working either.

I already have PowerShell Core installed and running. I would like to have both of them working simultaneously.

Is there any other way to fix Windows PowerShell 5.1?

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

8 answers

Sort by: Most helpful
  1. Anonymous
    2021-12-09T05:39:26+00:00

    Hello Srijith. I'm Greg, 10 years awarded Windows MVP, specializing in Installation, Performance, Troubleshooting and Activation, here to help you.

    Try these fixes to repair or reinstall Windows Powershell 5.1:

    https://windowsreport.com/windows-powershell-st... (Avoid ad links which intrude into editorial copy, especially avoid Restoro, PC Repair Tool and Reimage ads)

    UNINSTALL: https://www.thewindowsclub.com/how-to-uninstall... (Avoid ad links which intrude into editorial copy, especially avoid Restoro, PC Repair Tool and Reimage ads)

    REINSTALL: https://docs.microsoft.com/en-us/skypeforbusine...

    https://www.reddit.com/r/PowerShell/comments/ig...

    https://www.addictivetips.com/windows-tips/how-...

    If none of that works you can try to upgrade to 7.1:

    https://4sysops.com/archives/how-to-install-and...

    I hope it helps to have all options. Feel free to ask back any questions and I will be here to help.

    ______________________________________________

    Standard Disclaimer: There are links to non-Microsoft websites. The pages appear to be providing accurate, safe information. Watch out for ads on the sites that may advertise products frequently classified as a PUP (Potentially Unwanted Products). Thoroughly research any product advertised on the sites before you decide to download and install it.

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2021-12-09T06:44:50+00:00

    Thanks @Greg for the comprehensive list of links to resolve this issue.

    I have tried everything except reinstalling/repair Windows

    I know how is messed up the setup by deleting the packagemanagement folder from all the locations where PowerShell looks for the cmdlet.

    I cannot reinstall the system on my own as this is work machine and it is too much of work setting up everything.

    Now I think my last resort before giving up on making Windows PowerShell to work side-by-side with PowerShell core, is to copy the files for powershell from another machine into this one and see if that helps.

    I was expecting to get the package to be downloaded from some MS provided source.

    Thanks a bunch.

    0 comments No comments
  3. Anonymous
    2021-12-09T06:54:25+00:00

    I did not suggest to reinstall Windows. The steps labeled Uninstall and Reinstall are for Powershell 5.1. There were many other steps to try as well, I found all of them for you.

    Please do not skip any steps. We often find out later that the fix was the skipped step. If you need help performing any step I will help.

    0 comments No comments
  4. Anonymous
    2021-12-09T07:01:49+00:00

    what is it??/

    0 comments No comments
  5. Anonymous
    2021-12-09T07:14:13+00:00

    The only option to remove is from Windows Optional feature.

    I tried that before opening this post and it didn't work.

    The other two options are not applicable.

    UNINSTALL: https://www.thewindowsclub.com/how-to-uninstall...

    I have also tried reinstalling .Net Framework, still not fixed.

    1 person found this answer helpful.
    0 comments No comments