Not able to run commands

So i dont know what i have done, however I am not able to run commands like Install-Module or Update-Package.

I am new to Powershell and with my job i have been tasked with trying to automate some Azure stuff using powershell, in order to do that i need to first get it working correctly. Hoping someone can help out here.

Thanks in advance.

@TWagg Welcome to PowerShell.org forums.

Can you share the error message you get when you try it ? It will help folks here to help you better.

Sure, this is what i get when i try to use Install for instance. Its the same with just about any command. Its like I lost alot of basic commands. I am using PS 5.1, im on a windows 2016 server.

PS C:\WINDOWS\system32> Install-Module Azure
Install-Module : The term 'Install-Module' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Install-Module Azure
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Install-Module:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Maybe this will help:

That seems like a work around. I would really rather just be able to fix the issue. Any idea on how to fix it?

Did you try something already? If yes what?

A Google search brings up some approaches to try:

https://www.google.com/search?q=Install-Module+%3A+The+term+'Install-Module'+is+not+recognized+as+the+name+of+a+cmdlet%2C+function%2C+script+file%2C+or+operable+program.+Check+the+spelling+of+the+name%2C+or+if+a+path+was+included%2C+verify+that+the+path+is+correct+and+try+again.&oq=Install-Module+%3A+The+term+'Install-Module'+is+not+recognized+as+the+name+of+a+cmdlet%2C+function%2C+script+file%2C+or+operable+program.+Check+the+spelling+of+the+name%2C+or+if+a+path+was+included%2C+verify+that+the+path+is+correct+and+try+again.&aqs=chrome..69i57.9707628j0j9&sourceid=chrome&ie=UTF-8

https://answers.microsoft.com/en-us/windows/forum/all/powershell-error-install-module-is-not-recognized/f2d21c43-2715-463f-b7ca-e65b31b93f49

Yes sir, i tried google searching for hours, not exaggeration, and saw probably 15+ different possible solutions but nothing helped. So the first one asks you to run Get-PSRepository, this returns the same error. Not a recognized command.

The second one you posted assumes that you do not have version 5+ i have windows 2016 server which ships with 5.1 and checking version numbers that is indeed what i have.

I really am at a loss here. Can i possibly uninstall and reinstall powershell somehow and start over?

Since PowerShell is a feature of the operating system you can enable or disable you can try. But if nothing else works you should consider re-installing the server completely. Depending on the service the server runs for you that could be faster than continuing to search for the failure cause.

Or you could install PowerShell 7. :wink:

And you tested the 32bit PowerShell as well? A link sent in this thread showed that command had no issues with 32bit. Just curious if you tested that.

Does it happen if you try a different user or delete your profile from the server?

I had a similar problem earlier this year on my home PC which I just couldn’t get to the bottom of. A whole bunch of PowerShell commands just stopped working. Different error to what you’re getting; I was seeing:
The <cmdlet-name> was found in the module <module name> but the module could not be loaded.
Get-Module -ListAvailable shows the version number as 0.0 for all the affected modules.

I created a new user on my PC and it’s been fine on the new account. If I log on with the old account, the commands still don’t work.

Ill try to see if i can disable, reboot and enable it as soon as the server gets some downtime. However this is a production server and reinstall is not an option. Powershell 7 works but im trying to automate azure and the remote commands will only go through 5.

tonyd, the 32 bit version seems to work ok, but its the same issue the automation requires the 64bit. Ive tried to work around that as well :-/

matt-bloomfield, this is a corp PC i cant exactly use a different user. That does give me an idea about trying to wipe out my user account folder on this server and have it re-create it. I wont be able to try that until later tomorrow night tho.