Extending .NET Objects in PowerShell

One of the great features in PowerShell 2.0 is the ability to extend .NET object types to add additional custom properties and methods.  For instance, the type System.String does not have a property called IsANumber that returns whether or not the string is a number.  Typically, you would have to do a TryParse.  By extending…


Custom Site Definition Alternative

This came up for a recent customer, so thought I would share my solution as many people are not aware of this customization possibility.  The solution ultimately solved the problem that feature staplers activate features BEFORE any lists are provisioned on a site.  So, the only eloquent way to modify a list or list item…


SharePoint Administration with PowerShell

Last weekend, I had the opportunity to speak at Boston’s SharePoint Saturday.  I met some great people, enjoyed some EXCELLENT food, and talked A LOT of SharePoint. For those who couldn’t make it, here is a link to the slide deck from my session: SharePoint Administration with PowerShell View more presentations from Eric Kraus.


SharePoint + PowerShell Memory Leak

It’s very important that anyone working with SharePoint object model be concerned with the appropriate management of memory.  Most developers are aware of the need to dispose objects properly, but we some times get sloppy when it comes to things like PowerShell. Zach Rosenfield just posted a very important note for anyone using PowerShell with…


Cannot remove file "". Error Code 158

While developing a custom feature receiver, I was attempting to delete a masterpage file from the MasterPage Gallery when I received an SPException with the message:  “Cannot remove file “<filename>”.  Error Code 158″  Since I found no help on the web, I thought I would share this simple solution.  I did the usual routine of…


SharePoint Automated Deployment Using MSBuild

MOSS Automated Build & Deploy with MSBuild  Here are the steps to create an MSBuild script to: 1.      Label Visual Source Safe project with a new version 2.      Get latest source code to a build server 3.      Compile source code 4.      Look for .DDF files 5.      Build WSPs based on DDF files 6.      Deploy WSP…


SQL Profile Import with Forms Based Authentication

This has come up several times now and I thought I would contribute a solution that has worked for me.The problem:  Need to create an Audience based on a profile of a SharePoint user.  The users is, however, stored in a SQL Server membership database (outside the context of SharePoint).  The user profile needs to…