PowerShell 4 - Import-Module : The specified module 'SQLPS' was not loaded because no valid module file was found in any module directory

Yogesh Patel picture Yogesh Patel · Oct 30, 2015 · Viewed 53.6k times · Source

Previously working with PowerShell 3. Upgraded to PowerShell 4 and uninstalled it as facing error stated. Import-Module : The specified module 'SQLPS' was not loaded because no valid module file was found in any module directory. But all SQL related stuff is working fine without the error. What is the root cause of this error in PowerShell console?

Answer

RiverHeart picture RiverHeart · Mar 27, 2016

Sounds like you need to manually update the module path.

Check to see that this directory exists on the computer.

C:\Program Files (x86)\Microsoft SQL Server\110\Tools\PowerShell\Modules\SQLPS

[Fixed]

If it does then run

$env:PSModulePath = $env:PSModulePath + ";C:\Program Files (x86)\Microsoft SQL Server\110\Tools\PowerShell\Modules"

Then check to see if the SQLPS module is in the list of available modules using

get-module -listavailable