title: PowerShell Snapin Cmdlet CommandNotFoundException
body: <p>Currently I'm trying to create my first PowerShell Snapin. I followed this tutorial: <a href="http://zimmergren.net/technical/sp-2010-how-to-create-a-powershell-snapin-part-1" rel="nofollow">How to create a PowerShell Snapin</a> and everything works fine until I'm trying to invoke my custom cmdlet. In addition I added a "Post Build Event" to register the assembly.</p>
  
  <pre><code>"C:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe" $(TargetPath)
  </code></pre>
  
  <p>Afterwards I added the Snapin and it worked like a charm:</p>
  
  <pre><code>Add-PSSnapin CustomSrv.Commands
  </code></pre>
  
  <p>Path to the assembly for the System.Automation reference:</p>
  
  <pre><code>C:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0\System.Management.Automation.dll
  </code></pre>
  
  <p>As my Target Platform I selected x86 and I'm also executing everything in x86 PowerShell. Platform is set to "Active (Any CPU)"</p>
  
  <p>This is my cmdlet code:</p>
  
  <pre><code>namespace CustomSrv.Commands
  {
      [Cmdlet(VerbsCommunications.Connect, "CustomSrv")]
      public class TestCmdlet1 : Cmdlet
      {
          protected override void BeginProcessing()
          {
              WriteObject("BeginProcessing() method - Execution has begun");
          }
          protected override void ProcessRecord()
          {
              WriteObject("ProcessRecord() method - Executing the main code");
          }
          protected override void EndProcessing()
          {
              WriteObject("EndProcessing() method - Finalizing the execution");
          }
      }
  }
  </code></pre>
  
  <p>This is the error I'm getting when I'm trying to invoke the Cmdlet:</p>
  
  <pre><code>PS C:\WINDOWS\system32&gt; Connect-CustomSrv
  Connect-CustomSrv: The term 'Connect-CustomSrv' is not recognized as the name of a cmdlet, function, script file, or
  operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
  again.
  At line:1 char:1
  + Connect-CustomSrv
  + ~~~~~~~~~~~~~~~
      + CategoryInfo          : ObjectNotFound: (Connect-CustomSrv:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
  </code></pre>
  
  <p>What I'm a doing wrong, is there something setup wrong concerning the targeting platform (x86)?</p>