Server Fault is a question and answer site for system and network administrators. 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 created a custom powershell cmdlet that i have registered in powershell. Of course everytime i close my specific powershell instance i have to execute the following to have access to the command again:

add-pssnapin MyCustomSnapIn

I've tried to google for the answer and the only thing i'm finding is to do the following:

export-console MyCustomCmdletPowerShell

But nothing i found tell you to reimport this into powershell or how to automatically reimport it into powershell (which i prefer). Apparently it doesn't happen automatically.

share|improve this question
Have you tried adding the add-pssnapin command to your profile? – Christopher Nov 10 '10 at 15:08
Sorry Christopher but can you explain more? Does PowerShell have some type of profile? I'm pretty new (few days) to powershell. – coding4fun Nov 10 '10 at 15:11
up vote 2 down vote accepted

You need to add the add-pssnapin MyCustomSnapin command to your profile. Once you do that, the snapin will load each time the Powershell environment runs.

On XP, you can reach your personal Powershell profile in My Documents\Windows Powershell\profile.ps1.

There are actually 4 different profiles in Powershell. Check out this MSDN article for more information -

share|improve this answer
In PS you can notepad $profile to edit your profile too. – Chris S Nov 10 '10 at 15:34
Thanks Chris. That was it. I was confused at first and tried to use the file the export command created above which didn't work of course since its an XML file. I just put the add command to my profile and everything worked correctly. I appreciate your help – coding4fun Nov 10 '10 at 15:42

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.