Register-PSRepository and Install-Module could not be recognized error in case of Windows Server 2012

Recently, when I tried to run PS commands like Register-PSRepository and Install-Module commands in Windows Server 2012, received command couldn't be recognized error. Also, C:\Program Files\WindowsPowerShell was missing a few folders compared to Windows 10 Pro file system. Simultaneously, the PowerShell version was 4.0 - checked by running $PSVersionTable and viewing the PSVersion value.


Due to this, commands like Register-PSRepository and Install-Module will throw "command could not be recognized" error.

In that case, download Windows Management Framework 5.1 and install. After this, if you run $PSVersionTable, you will see PS Version upgraded to 5.x and now Register-PSRepository and Install-Module commands will be recognized.



Comments