I’ve been using the Community Extensions for PowerShell for some time now but for various reasons haven’t had the time to really dive in and learn it (or PowerShell) the way I’d like.  My company (well, the IT department at my company) is now standardizing on using PowerShell in place of cmd.exe and using the community extensions.  In the process I found a couple glitches with it that I wanted to share with the community (that would be you).

Bug in CD

There is a bug in the CD command that causes the new location to always be displayed.  It has apparently been fixed in the forth-coming 1.2 release.  Here is what you need to do to fix it in the current release.

  1. In the $Env:ProgramFiles\PowerShell Community Extensions folder edit the cd.ps1 script.
  2. On line 202, change the check from:
    if (!$PassThru) { (Get-Location).ProviderPath }
    to
    if ($PassThru) { (Get-Location).ProviderPath }
  3. Restart PowerShell.
Using a shared profile

We are planning to write shared profile scripts that everyone executes which will include the default PSCX profile script.  Here are some problems I found with doing this.

  1. The script expects you to edit it to specify the EyeCandy script to execute.  My suggestion to the PSCX developers was to not execute any script or allow it to be bypassed.  I had to edit the profile script to comment this code out.
  2. The script sets the ProfileDir and UserProfile variables based on the location of the script.  In our case, this is in a directory that is managed by source control.  I ended up removing those variables and redefining them in our company-specific profile script.  I suggested that the PSCX developers define them based on the value of the $profile variable, which is what I do.  Hopefully they will do that in the upcoming release.
Resources

You can read my previous article on the Community Extensions and my series on PowerShell here: