I want to build a PS module. It contains two function like this:
Function Start-SqlInstance{
param([string] instanceName)
....
}
Function Stop-SqlInstance{
param([string] instanceName)
....
}
My PowerShell default path contains "C:\Users\Administrator\Documents\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\", I cant get it from $Env:PSModulePath. and my module definition file was saved in the folder ":\Users\Administrator\Documents\WindowsPowerShell\Modules" with name "CustomTools.psm1".
The problem is that I got an error "the specified module 'CustomTools' was not loaded because no valid module file was found in any module directory" when I tried to import with following cmdlet Import-Module "CustomTools.psm1". But the module would be imported when I tried with full path like this "C:\Users\Administrator\Documents\WindowsPowerShell\Modules\CustomTools.psm1".
The help note said that when you import a module, it will search in the default module path first. But why I cannot import the module with the short name.
Who can help me?
And it is very very diffcult to find the correct forum categary in msdn....
Young