Architecting and Building Your Farm Using PowerShell Part 1

This is a live blogging post from the International SharePoint Conference London 2012. So don’t expect well-written proza here.

Session by Gary Lapointe, Chandima Kulathilake, Spencer Harbar

Note: live blogging PowerShell code isn’t exactly easy, so this abstract primarily contains snippets of some takeaways

Use PowerShell to achieve speed, consistency, reliability and repeatability in your farms setup. Treat it like production code that goes through iterations and apply the same application lifecycle mgmt principles as you would for other code!

The scripts should stay unchanged, only the XML config files change for each environment.

Creating your farm

  • Install-SPHelpCollection and Install-SPApplicationContent are not really needed
  • Don’t put your passwords in the scripts!
  • Make your scripts resilient, so you can run them again when one part fails
  • During installation you’ll have to remove the SharePoint add ins and add them back in because some commands only are available after farm creation

Logical Architecture

  • Always use web applications in different application pools than your service applications

Creating Web Applications

  • There is no way to manage or get a reference to your existing web applications application pools by default unfortunately
  • To use claims, you need to have a New-SPAuthenticationProvider call (use an array when you have multiple)
  • Get-SPSite offers a lot of possibilities, be sure to explore it beyond the surface!
  • Use “splatting” for optional parameters: a hash table of key/value pairs to be passed into the cmdlet so you don’t have to specify every option
  • You can set user policies (web application policies) with PowerShell too
  • You don’t need to instantiate the web applications on all servers, just the web servers will do