Win free SPCAF licenses!

To celebrate the latest SPCAF release 4.5.2. and the availability of SPCop, SPDepend, SPMetrics and SPInventory as separate products my company Rencore is giving away

  • 1 x SPCAF Professional
  • 1 x SPCop Developer Edition
  • 1 x SPDepend
  • 1 x SPMetrics Developer Edition
  • 1 x SPInventory Developer Edition

altogether worth over

$7,700.00

So what are you waiting for, enter the raffle now!

Disclaimer: Each license is the full version of the product and valid for one year. After that the winners can continue using SPCAF by purchasing the annual Software Assurance.

a Rafflecopter giveaway

Building your own extension for SPSD

SharePoint Solution Deployer (SPSD) has grown to a quite big script and even though it supported custom targets/events from the beginning, it was fairly difficult to update SPSD and also re-use your custom PowerShell commands without intensive testing.

The new extension system introduced with the recently released SPSD5 solves these problems.

What is an extension?

Basically everything that SPSD does not out of the box during the deployment process.

An extension could be for example:

  • a simple script to change some farm settings
  • creating webapplications or site structures
  • activate features
  • set permissions
  • create/import demo content
  • create service applications
  • configure the farm
  • import managed metadata
  • etc….

Extensions can be registered with different functions for multiple events i.e. Initialize, BeforeDeploy, AfterRetract etc.

Following extensions are already work in progress and will be released in the next couple of weeks:

  • SiteStructure: Create Site Collections (optional with custom ContentDB), subsites, assign permissions
  • ContentTypeHub: Create/Remove and configure ContentTypeHub
  • ManagedMetadata: Backup and Restore Managed Metadata Termsets and MMS configuration, including custom properties and multilingual lables/descriptions
  • LoggingConfiguration: Creates/Removes logging areas and categories based on SP Guidance logging
  • several more simple extensions like “SetMaximumFileSize”, “SetBlockedFileExtensions” etc.

So stay tuned :)

The big advantage about the extensions is that they can be updated independently of SPSD.

Additionally this allows you  to re-use the extension in several projects.

I plan to add the extensions to the Technet galleries with the tag “SPSD” so that people can vote and comment on them. If you like to publish your own extension then it would be great if you do the same to make them easy findable.

You are also welcome to modify and re-publish extensions if you have improved them or found a better approach.

How to create an extension?

Extensions are very easy to create.

They consist of

  • extension folder in the Scripts/Extensions folder which
    • must have a manifest.xml file, letting SPSD know that the extension exists
    • a .ps1 file with your custom PowerShell commands (see Example.ps1)
  • extension configuration file in the SPSD/Environments folder
    or a section in an existing environment file (see Environments/Example.xml) which tells SPSD which custom PS function it should run during which deployment step.

Manifest

The manifest file is stored in the folder /Scripts/Extensions/<extensionname>  and defines

  • the extension type (a unique type to identify the extensions),
  • the version
  • the associated script file and
  • if the extension is currently enabled or disabled
<?xml version="1.0" encoding="utf-8" ?>
<SPSD>
  <Extensions>
    <Extension>
        <Manifest>
            <Type>Example</Type>
            <Description>
                This is an example to show how the SPSD extensions system is working.              
            </Description>
            <Version>1.0.0.0</Version>
            <Script>Example.ps1</Script>
            <Enabled>true</Enabled>
        </Manifest>
    </Extension>
   </Extensions>
</SPSD>

By specifying the manifest, SPSD can automatically pick up your extension and register it for deployment actions.
The extension will be loaded inline, which means that functions and variables of the extension script are not available after the extension is done.

This means that your extension cannot harm the rest of the execution of SPSD, but also that you cannot (and should not) pass information from one extension to another.

Also all disposable objects allocated in the extensions script will be automatically disposed  by SPSD when the extension is finished.

Script

To implement an extension script you just create a .ps1 file in the /Scripts/Extensions/<extensionname> folder and define a function with following parameters

  • $parameters : a collection of all named parameters defined in the extension configuration file
  • $data : the <Data></Data> node of the extension configuration file (see next section)
  • $extId : the extension Id as defined in the extension configuration file (manifest.xml)
  • $extensionPath : the path to this file, in case you require to load from other files in the extensions script folder

This could look like the following

function Execute-ExampleExtension($parameters, [System.Xml.XmlElement]$data, [string]$extId, [string]$extensionPath){
        Log -message "Parameters:" -indent -type $SPSD.LogTypes.Normal
            Log -message ("Parameter1: "+ $parameters["ExtensionParameter1"]) -type $SPSD.LogTypes.Normal
            Log -message ("Parameter2: "+ $parameters["ExtensionParameter2"]) -type $SPSD.LogTypes.Normal
        LogOutdent

        Log -message "Data:" -indent -type $SPSD.LogTypes.Normal
        foreach($node in $data.ChildNodes){
            Log -message ($node.Name + ": "+ $node.innerText) -type $SPSD.LogTypes.Normal
        }
        LogOutdent

        Log -message ("Extension ID: "+ $extId) -type $SPSD.LogTypes.Normal
        Log -message ("Extension path: "+ $extensionPath) -type $SPSD.LogTypes.Normal

        # implement your extension here    
    }

Note that this example is using the SPSD logging function. This assures that your extension output is not only printed out to the console but also is saved into the SPSD log file.

Environment Configuration

Although SPSD is now already picking up the extension and reading the manifest, you have to tell it on which deployment commands you like which function to be executed.

If you have used SPSD before, you know already about the environment files in the /Environments folder, which allow you to configure SPSD to your liking.

The following XML describes how an extension is configured.

<SPSD Version="5.0.3.6438">
  ... SPSD configuration ...
  <Extensions>
    <!-- This represents the extension configuration of the specific instance "ExampleInstance1" of-->
    <!-- the extension of type "ExampleExtension" -->
    <Extension ID="ExampleInstance1" Type="Example">
      <!-- Here you register the methods of your extension .ps1 file to one or several events -->
      <!-- You can also register multiple methods to the same event. -->
      <Events>
        <!-- This examples lists the available events -->
        <!-- The PowerShell function requires to accept the parameters as described in the Example.ps1 file -->
        <Event Name="BeforeDeploy">Execute-ExampleExtension</Event>
      <!--
        <Event Name="AfterDeploy"></Event>
        <Event Name="BeforeRetract"></Event>
        <Event Name="AfterRetract"></Event>
        <Event Name="BeforeUpdate"></Event>
        <Event Name="AfterUpdate"></Event>
        <Event Name="Initialize"></Event>
        <Event Name="Finalize"></Event>
        <Event Name="ProcessSolution"></Event>
        <Event Name="Preconditions"></Event>
       -->
      </Events>
      <!-- Here you can define parameter which are passed to the methods which are registered for SPSD events -->
      <!-- Each parameter is a key value pair -->
      <!-- You can also use SPSD variables here which will be resolved automatically on runtime -->
      <Parameters>
        <Parameter Name="ExtensionParameter1">$(UserID)</Parameter>
        <Parameter Name="ExtensionParameter2">Parameter</Parameter>
      </Parameters> 
      <!-- Here you can define you custom data XML structure which will be passed to the registered PowerShell functions -->
      <!-- You can also use SPSD variables which will be resolved automatically on runtime -->
      <Data>
        <ExampleNode>$(SiteUrl)</ExampleNode>
        <ExampleNode>Example</ExampleNode>
      </Data>
    </Extension>
  </Extensions>
</SPSD>

You can register your PowerShell function(s) to one ore multiple events and SPSD will pass the parameters and your custom xml data to them.

Available events are:

  • BeforeDeploy : Execute before the deployment tasks are started
  • AfterDeploy : Execute after the deployment tasks have finished
  • BeforeRetract : Execute before the retraction tasks are started
  • AfterRetract : Execute after the retraction tasks have finished
  • BeforeUpdate  : Execute before the update tasks are started (only when running “Update-SPSolution”)
  • AfterUpdate : Execute after the update tasks have finished (only when running “Update-SPSolution”)
  • Initialize : Executed after SPSD has initialized
  • Preconditions : Executed after SPSD has checked all pre-conditions. You can break the whole deployment by throwing a exception if your custom condition is not met.
  • Finalize : Executed after SPSD is done
  • ProcessSolution : Executed on every action happening to a specific solution (runs on deploy, retract and update for each WSP)

Tip: SPSD Environments files have also the ability to load any XML node from a separate file. So in order to keep your environment configuration nice and clean (and maybe re-use the extensions configuration for different environments) you should put it into a separate file and reference it.
A reference would look like this

<SPSD Version="5.0.3.6438">
  ...
  <Extensions>
    <Extension ID="ExampleInstance1" Type="Example" FilePath="Extensions\Example.xml" />
  </Extensions>
</SPSD>

The complete example extension is included in the current release and can also be downloaded separately from CodePlex.

How to test your extensions?

SPSD now has an additional batch file which starts the main script with the

  • DeploymentType = “Extensions” and the
  • DeploymentCommand = “Ask”

This means that when executing this batch, SPSD runs, but skips the actual deployment of the WSPs to speed up the process.

The “Ask” command results in SPSD asking you which deployment command you want to perform (Deploy, Retract, Redeploy, Update) before the script runs.

Summary

The new SPSD extension system allows you to build and re-use your custom scripts and integrate them with no effort into SPSD.
Migrating existing scripts is very easy by just providing a caller function which meets the extension requirements.

If you have new ideas for extensions please don’t hesitate to leave a comment here or on CodePlex!

In future posts I will explain how the extension system is actually built and also show off the extensions I have already built.

Until then feel free to check out the source code yourself :)

SPSD 5 released!

BannerGross_SPSDFinally after long developing and testing I released the next major release of the SharePoint Solution Deployer PowerShell script!

SharePoint Solution Deployer, short SPSD, is a highly configurable but easy to use PowerShell script to deploy WSPs to SharePoint 2010/2013. It runs important prerequisite checks, post deployment actions and allows to “hook” in your custom PowerShell actions. It is optimized to be used for staging environments and team development by supporting different configurations with one set of scripts.

This new release includes many bugfixes and improvements based on community feedback from the CodePlex site.

Thank you!

The biggest addition (and the reason for a major release) is the new extension system which is described in the next post “Building your own extension for SPSD”.

SPSD v5.0.3.6438

  • New: SPSD now has an extension system which allow you to create your custom PowerShell extensions and integrate them in the deployment process!
  • New: Added and example extension
  • New: Environment file can now be passed as parameter to the batch files
  • New: Added timestamps to better measure execution time
  • New: Added new deployment command “Ask” which asks the user for the deployment command.
  • New CP16167: SPSD now works also when run though an application (e.g. console app), output will be just logged into the log file
  • New: Countdown after deployment until windows closes
  • Updated: SharePointVersions.xml to include new SharePoint versions for SP2010/SP2013
  • Changed: Renamed CustomTarget SkipSolution to ProcessSolution
  • Changed: Stability improvements
  • Changed: Memory disposal improvements
  • Fixed CP16490: Incompatible with PowerShell 4.0 due to switch statements
  • Fixed CP16441: Compatibility Level ignored for global deploys
  • Fixed: CloseAllPSSessions had unused parameter in signature
  • Fixed: Startup in batch with relative path when not running from cmdline was failing when user UAC was enabled

SP24 – The free 24h worldwide SharePoint conference!

SP24badge

Huh! You haven’t heard? Let me fill you in!

Together with an awesome dedicated team of SharePoint addicts who already run together SharePoint-Community.net, I am organizing SP24, the first free, 24h, worldwide, online SharePoint conference!

Think about it as a SharePoint Saturday, only global instead of local, on a Wednesday instead of a Saturday, with an audience of thousands instead of a few hundred, online instead of on-site, 24h instead of 8h…

Ok, to be honest the only thing in common with a SharePoint Saturday is that it is all about SharePoint , has great speakers and sessions and is entirely free for the attendees!

Already sold?

Then register now and mark April, 16th 2014 red in your calendars!

Here is the deal!

  • SP24 lasts for 24 hours and will follow the sun from New Zealand to Hawaii.  It will begin on April, 16th 2014 at 10 pm GMT and will end 24 hours later.
  • SP24 will feature speakers that are voted for by the community (Note: some slots are already reserved for experienced speakers and world-renowned SharePoint experts)
  • SP24 sessions will be hosted live and you will have the possibility to interact with the speaker and other attendees through integrated chat.
  • SP24 has 2 tracks, one to appeal to Business Users and one for Technical Users such as developers and administrators.
  • SP24 is going to be held entirely on-line.
  • SP24 is following a similar format that has already been proven to ​be really successful at two TFT13 conferences.
  • The SP24 conference will be run on a site which is built on SharePoint 2013 hosted by Fpweb.net.
  • And perhaps the best part, did I mention that SP24 is completely FREE? :)

So once again:

Want to attend?

Register now and mark April, 16th 2014 red in your calendar!

Want to speak?

Submit your session right away. Deadline is January, 31st 2014. The earlier you submit, the better are the chances to get many votes!

Want to sponsor?

I probably don’t have to say what great opportunity it is to sponsor SP24 given the worldwide audience and the number of attendees.

I sponsor myself with RENCORE, the company behind the SharePoint Code Analysis Framework (SPCAF).

So if you like to chime in, send an email to Vlad Catrinescu​!

SP24 is happening!
Meet you there!

SharePoint Server MVP 2014!

I just received the notification that I was awarded SharePoint Server MVP by Microsoft!

Speechless :)

MVP

I would like to thank Microsoft for giving me this award and everyone in the SharePoint community for inspiration, support and feedback on my work.

You are just awesome!

Thank you!