SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a custom module and want to load it in the command shell without having to call it explicitly each time I delve into Powershell.

Does it load automatically?

If not, how can I make it load automatically?

share|improve this question
up vote 3 down vote accepted

From PowerShell, evaluate the variable:


Verify that the directory specified in $profile exists, create the file if necessary (note: The directory and file are created by the user. Until you do so the first time neither the directory nor file will exist). Edit file specified by $profile in your favorite text editor. At the end of the profile add the line:

import-module <path-to-module>

If you use custom nouns/verbs and you want to avoid the noisy warnings just add the flag "-DisableNameChecking" to your import module call.

import-module <path-to-module> -DisableNameChecking

Now, reload your shell.

If you'd like to 'publish' your module so that you can import the module by name rather than by path then make a directory for your module under one of the directories in "$env:psmodulepath" (the one under windows is a system wide module repository) and copy your module file(s) there. Once you've done that you can import your module by name instead of by path.

import-module <name-of-module>
share|improve this answer

I think you have to do two things

  1. Add you module to your Documents folder (Documents\WindowsPowerShell\Modules)

  1. Modify your profile file (Documents\WindowsPowerShell\Profile.ps1) to have the include

eg Import-Module Pscx

And if that doesnt work try adding your import to:

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\sharepoint.ps1

Thats the file the sharepoint powershell console imports

share|improve this answer
Editing the SharePoint.ps1 file stops my console from loading correctly so I suggest people don't try doing that. – Neil Richards Jan 19 '11 at 11:09
Also, there's no Profile.ps1 in the location suggested (although the Interweb suggests there should be). Just to clarify I'm on a Win2008R2 server rather than Win7. – Neil Richards Jan 19 '11 at 11:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.