Back to blog

Powershell CMDLET Development Settings


PowerShell snapins are a great way of exposing useful tools to your team, we can provide hooks into our existing code allowing us to leverage the investment in the code base through a simple cmdlet.

There is a bit of a gotcha with PowerShell development however; if you need to be able to execute .NET 4 assemblies within PowerShell you will need to add a little extra configuration to each computer that will need to utilise your .NET 4 assemblies.

  • Create a file in “C:\Windows\SysWOW64\WindowsPowerShell\v1.0\” named “powershell.exe.config”.
  • Open this file in a text editor; this will need to be running “as an Administrator”
  • Paste the following XML into the text editor

Once this is in place you are set to load any .NET v4.0 or v2.0 assembly into PowerShell.

There are a large number of excellent articles on creating PowerShell snapins in .NET so I won’t re-invent the wheel.

At some point you will want to test and debug your snapin; you can save yourself a lot of time and hassle by automating the uninstallation and re-instalation of the snapin with the following pre-build and post build events:



If you are not familiar with Visual Studio 2010 build events, you can access them by right clicking on your Project, then selecting properties; “Build Events” appears as a tab down the left hand side.

If you want a full F5 experience when developing PowerShell cmdlets:

  • Select the “Debug” tab from project properties
  • Select “Start External Program” as the start action
  • In the text box enter
  • Enter

as command line arguments.

Amido: Surviving the Spike

Leave a Reply

Your email address will not be published. Required fields are marked *

The browser you're using is out of date. Please update for better security, speed and experience on this site.