Ivo Jesus
Ivo Jesus

Reputation: 35

How do I install a module using a PSM1 file?

I can not install the module pointing to the PSM1 file

Is it possible to install a .PSM1 module? With the Install-Module command I can not do it.

If it is not possible, how do I not have to import the module with Import-Module in all new sections.

Install-Module "\\servers\folders\module.PSM1"

Error Example:

Install-Module "C:\INFRA\PsSinqia.psm1"
PackageManagement\Install-Package : No match was found for the specified search criteria and module name
'C:\INFRA\PsSinqia.psm1'. Try Get-PSRepository to see all available registered module repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 char:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Packag
   e], Exception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Upvotes: 1

Views: 14730

Answers (1)

Ivo Jesus
Ivo Jesus

Reputation: 35

The correct folders are:

  • C:\Windows\System32\WindowsPowerShell\v1.0\Modules\
  • C:\Windows\SysWOW64\WindowsPowerShell\v1.0\Modules\

The folder and module must have the same name.

Reference: MSOnline can't be imported on PowerShell (Connect-MsolService error)

Upvotes: 1

Related Questions