OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Install-Module not available - not recognized as a name of a cmdlet

  • Thread starter Thread starter Lucky Luke
  • Start date Start date
L

Lucky Luke

Guest
I'm trying to take advantage of the PowerShell Gallery which requires Install-Module. For some reason I cannot get this to work on any computer I have access to:

Code:
Install-Module: The term 'Install-Module' is not recognized as a name of a cmdlet, function, script file, or executable program.

I tried this on a Windows 8.1, Windows 10 and even installed PowerShell 7.1 on the Windows 10 computer. I see that a lot of people have this issue, but other than installing WMF (which seems to already be included with Win10) I don't see any useful suggestions.

I don't have a lot of experience with PowerShell, and definitely not managing it, so I'm curious if anybody has an idea as to why this is not working.

Edit 1: I seem to have the PowerShellGet module in the following directories:

Code:
C:\Program Files\WindowsPowerShell\Modules
C:\Program Files\PowerShell\7\Modules

and the $env:PSModulePath variables contains C:\Program Files\PowerShell\Modules;c:\program files\powershell\7\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules

Edit 2: This may be related to the __PSLockDownPolicy environment variable, that was set to 4 on all of the affected computers. I was able to figure this out by attempting to manually load the PowerShellGet module, which yielded an error that hinted at this.

After removing that environment variable, it seems to work.
<p>I'm trying to take advantage of the PowerShell Gallery which requires Install-Module. For some reason I cannot get this to work on any computer I have access to:</p>
<pre><code>Install-Module: The term 'Install-Module' is not recognized as a name of a cmdlet, function, script file, or executable program.
</code></pre>
<p>I tried this on a Windows 8.1, Windows 10 and even installed PowerShell 7.1 on the Windows 10 computer. I see that a lot of people have this issue, but other than installing WMF (which seems to already be included with Win10) I don't see any useful suggestions.</p>
<p>I don't have a lot of experience with PowerShell, and definitely not managing it, so I'm curious if anybody has an idea as to why this is not working.</p>
<p><strong>Edit 1:</strong>
I seem to have the <code>PowerShellGet</code> module in the following directories:</p>
<pre><code>C:\Program Files\WindowsPowerShell\Modules
C:\Program Files\PowerShell\7\Modules
</code></pre>
<p>and the <code>$env:PSModulePath</code> variables contains <code>C:\Program Files\PowerShell\Modules;c:\program files\powershell\7\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules</code></p>
<p><strong>Edit 2:</strong>
This may be related to the <code>__PSLockDownPolicy</code> environment variable, that was set to <code>4</code> on all of the affected computers. I was able to figure this out by attempting to manually load the <code>PowerShellGet</code> module, which yielded an error that hinted at this.</p>
<p>After removing that environment variable, it seems to work.</p>
Continue reading...
 

Latest posts

Online statistics

Members online
0
Guests online
3
Total visitors
3
Top