Skip Ribbon Commands
Skip to main content

Quick Launch

Home
Occasionally useful ramblings and musings
April 25
PowerShell Script: SharePoint Farm Creation

For a long time I have been meaning to rewrite the PowerShell script that I have been using to do my SharePoint farm creation and just haven’t gotten around to completing the necessary effort to make it all that I want it to be. I have leveraged the work of others, borrowing a piece here and a snippet there but to honest I haven’t been satisfied.

What I really wanted was a script that I can use in my consulting practice as a normalized practice of how a farm should be deployed as well as a script that I could use in the highly repetitive process of doing ITPro dev work. I wanted something that was flexible enough to use for client installs, but repeatable enough that I could use it in my dozens of farm builds that I do in my spare time for troubleshooting and fun.

Here are the key points of what I did differently with this script:

  1. use temporary variables that can be accepted or overridden at the PowerShell command-line when the script is called 
    SNAGHTML37d3721b
  2. validate if the pieces have been implemented correctly & gives information about what piece failed, not just throwing the ugly PowerShell errors that we are used to seeing
    SNAGHTML37d4db9e
  3. validate that you are using PowerShell running as Administrator to ensure that you won’t fail for that silly reason
    SNAGHTML37d64475
  4. pulls the system & domain variables rather than having to set those parameters manually
    SNAGHTML37d7b73f

I am happy to report that I was able to accomplish all of these things in my script and am happy to offer it up for others to use if you see fit. I highly recommend that you consider using the PowerShell profile that I laid out in my previous article “How to: Automatically log your PowerShell session everytime” so that you can, among other things, capture the output of building your farm.

There are very few people who can honestly say that they created their PowerShell scripts completely from scratch, and I am certainly not among them. Credit is due for snippets & reference to Shannon Bray, Gary LaPointe, Brian Lalancette, Todd Klindt, & I’m sure others. Special appreciation to Evan Riser for helping me QA this script. 

One last thing to note about this script… it does just what it says it does. It creates a SharePoint farm.  This is not an all inclusive build your farm & configure every setting script. If you are looking for the all inclusive, über build & configure script please go visit Brian’s codeplex project: AutoSPInstaller. There is no need for anyone to recreate the amazing work that he has done. 

The reason I create this scripts like this is that I prefer to break my scripts down into pieces and keep them highly modular. This is partly because I consult on such a wide variety of projects that it makes my life easier to be able to deploy pieces at a time using different scripts. It also could be that I am a neurotic, lunatic control freak who is a bit over obsessed with developing in PowerShell for fun.  Hopefully it’s more the first thing than the second thing… :)

I will continue to publish the scripts that I find useful here in the hopes that it helps someone else along the way. You can find my SharePoint Farm Creation PowerShell script here on my SkyDrive.

spflogging_32
April 17
Updated PowerShell Profiles Creation Script

While enjoying Doug Hemminger’s presentation at the SharePoSH meeting tonight I realized that I hadn’t published an update to my How to: Automatically log your PowerShell session every time post, even though I had fixed some issues with the script more than 2 months ago.  FYI, I still blame Todd Klindt for prompting me to write this thing in the first place by introducing me to start-transcript…

I updated the version of code in the previous post from v1.8 to v1.14 without posting about it, however the output formatting was poor.

The major changes from v1.8 to v1.15 are:

1.) Proper formatting of screen outputs
2.) Added PowerShell Active Directory modules
3.) Outputting a validated list of snap-ins & modules that are actually loaded instead of just printing on screen that the SharePoint module loaded even when it hadn’t
4.) Validation that the user is running in the context of an Administrator
5.) Removed unnecessary code & added proper commenting inline

You can find the updated code at on SkyDrive here.

spflogging_32

April 15
Creating hotkeys for functions in Word 2013

In my previous posts on Enabling the “Mark Comment Done” & “Quick Switching between Review Markup Styles” I made reference to repetitive stress injury inducing activities and how to avoid them, but the biggest single improvement I made to my editing process for the book was creating a hotkey for Approving Comments.

I have long been a fan of Office Application allowing me to customize my toolbar and tabs, but until recently I did not realize what I was missing with creating hotkeys.  The operation is simple and intuitive and makes repetitive functions significantly easier to live with.

Simply right-click in the ribbon and select “Customize the Ribbon”

image

This will open the Word Options window where you will select the “Keyboard shortcuts:” customize button.

image

Once open you will select the tab that contains the feature you are looking to create a hotkey for.  In this case I selected the Review Tab and chose the AcceptChangesOrAdvance option.

image

To avoid the aforementioned repetitive stress injury inducing activity I chose to employ multiple key combinations so that I could switch hands as I went so that I didn’t over use one combination and cause myself to be a claw-handed, arthritis riddled, angry author.  The nice thing about the Customize Keyboard window is that it lets you know when key combination is already in use so that you can decide whether or not you want to override the existing hotkey or add an additional hotkey.

image

Once I assigned the changes I was able to go back to Word and use the hotkey right away.  This saved me a decent chunk of time as it allowed me to keep both hands on the keyboard and not to have to use the touch screen or the mouse.

spflogging_32

April 08
Quick switching between Review Markup styles in Word 2013

This is the second in a shorts series of helpful hits for editing using Word 2013.  You can find the first in the series Enabling the “Mark Comment Done” here. 

When I first started with the copyedit review of my book I used to go into the Review tab for each chapter and select to show All Markup each time.  This repetitive stress injury inducing activity was not only annoying, but it was counter productive as it made it difficult to understand the full context of the changes that were being proposed.

Happily I stumbled upon a feature that was previously unknown to me.  It is possible that this has been a part of Word in previous versions, but as I have not had to review documents in such a massive way until the book, I hadn’t ever bothered to look into the Markup features.

 

The feature that I am referring to is the inline show/hide side bar.

image

This side bar is grey when All Markup is being show and red when Simple Markup is employed.  To toggle between the two simply click on the side bar. 

image

This will allow you to quickly and easily see what changes are being made and what the output will look like without having to hit the toolbar, which is optimal when you are in a touch enabled environment such as a Surface or other tablet.

I found this feature to be invaluable when working on edits and reviews for the book.  Since no one had pointed it out to me before, I figured it was worth sharing.

spflogging_32

April 01
Enabling the “Mark Comment Done” feature in Word 2013

I am finally at the end of the first copyedit review for my book “Developing Business Intelligence Apps for SharePoint” and the experience has left me with some valuable tidbits about how best to edit 400+ page word documents.  I will post these during the course of the next week.

While co-author, Dave Feldman, and I are both using Office 2013 and had every intention of leveraging all of the great features that come as a part of the .docx format, we found that people in the book publishing biz tend to be on less up to date software and would send us drafts in .doc format.  This made it so that the “Mark Comment as Done” feature is not available.

image

Convert from Compatibility Mode

To solve this go to the File Menu (or Backstage) and select convert.

image

 

You will get a warning that you are about to upgrade to the newest file format to which you will say OK.

image

This will light up “Mark Comment Done”.

image

 spflogging_32

March 28
Speaking at RISPUG on 4/3/2013

If you are in the Southern Massachusetts/Rhode Island/Eastern Connecticut area Wednesday night (or even if you aren’t, it might still be worth the road trip… I’m doing it!) and are interested in learning about what’s new in SharePoint 2013 for ITPros, then come out to the Rhode Island SharePoint Users Group at Providence College.  In it’s seventh month RISPUG is alive and thriving, so come out and join us for a good old fashion geeky evening of SharePoint talk!

I will be presenting my ITPro’s taking the SharePoint 2013 Red Pill deck which is available on my Presentations Page or on my SlideShare.

spflogging_32

March 25
Upgrading an existing Office 365 Tenant to the latest SharePoint Online

After a very long wait I finally had a SharePoint Online tenant that was ready for upgrade.  For those who have not yet been blessed with this gift from Microsoft, I have screen captured the process for you to check out.  Sadly, SharePointLonghorn.onmicrosoft.com has not yet received the upgrade so I have not yet cut over completely to the cloud.

Enjoy! 

spflogging_32
March 21
SharePoint Road Show Presentations

For the last few weeks I have been lucky enough to speak at some amazing events, specifically SharePoint Saturday Philly, SharePoint Saturday Austin, SPTechCon & SharePoint Fest Denver.  Doing shows like this always remind me just how amazing the SharePoint Community is.  I get a chance to interact with people from all walks of life, all different experiences with technology, and all different levels of knowledge within the sphere.  Thank to everyone who attended my sessions at these events.  As promised, I have uploaded my decks to SlideShare.  They can also be found on my new Presentations Page.

I am excited to present for SPTechCon Boston & SharePoint Fest DC again, and on the East Coast this time, later this summer. 

spflogging_32

March 13
Debugging an Explorer View issue

During a recent SharePoint 2010 upgrade project, we applied SP1 and DEC 2012 CU & encountered a frustrating issue. Everything in the farm was working as expected after we did the installation & ran PSCONFIG, except for an issue where some users could not use Explorer View to open some Document Libraries.

More detailed user testing revealed that the issue only occurred for user who were using computers running Windows Vista or later. Windows XP users could open in explorer view without a problem.

WebDAV vs Front Page RPC

The reason for the OS disparity is due to the different protocols by which SharePoint will try to open in Windows Explorer. As it is explained in a Microsoft white paper from 2006 on SharePoint Explorer View:

“The Explorer View prefers WebDAV over FPRPC. Because of the underlying design of the Explorer View and the default network provider order, it always tries to use SMB first, then WebDAV. Only when SMB and WebDAV have failed does it actually attempt to use FPRPC. This means that forcing the Explorer View to use WebDAV is more a case of creating an environment that makes sure WebDAV is successful instead of actually forcing the Explorer View to choose it.”

While the WebDAV protocol relies on the Web Client Service, the FPRPC protocol does not, instead relying on WebFolders. WebFolders are disabled by default beginning in Windows Vista, but are available in Windows XP which explains why Explorer View worked in XP and not later Windows OS.

Compounding the confusion

This client was leveraging nested managed paths. This caused a secondary issue because the managed path contained a “\”, causing the WebDAV protocol not to be able to parse the address. The fix simply involved creating a wildcard Managed Path for the first part of the compound address. So if you have a URL which is “state\county” you would just add a managed path for “state” and explorer view via WebDAV will work. Here is what this would look like:

clip_image001

Take Away

The lesson here is to avoid using compound Managed Paths in your SharePoint web applications. If you absolutely must use compound managed paths be sure to add a wildcard path for the first part of the compound path.

Thank you's

A big thank you to Todd Klindt, of Rackspace, for giving us some good leads & Evan Riser from my team for chasing this all the way down the rabbit hole to a resolution.

spflogging_32

February 13
Creating a Sysprepped Windows Server 2012 image

One of the advantages to running Windows Server 2012 is the highly improved Hyper-V engine. In my time working on deployment scenarios I have found that creating a reliable baseline VM is critical to my success in getting farms deployed quickly and easily. To this end I have found that getting a new VM server with the OS installed to the correct level with patches, the SharePoint prerequisites, and all of the customizations that I like to have on a server already installed and ready to go in minutes is pretty important.

This is where Sysprep comes the picture. We have been using Sysprep to prepare images since Windows XP as it allows us to generalize the critical system GUIDs and when the image is launched post-Sysprepping it will create new GUIDs and allow you to re-register the system. While this has always been a recommended practice for deploying the same VM over and over, it has not been a required function until Windows Server 2012.

There are some drawbacks to generalizing a system that you are trying to deploy. For example, once a server has been registered in a SharePoint farm that server cannot be expected to interoperate properly once generalized. Translation: you can't join a SharePoint server to a farm, then do a generalized Sysprep, and expect the new server to be a member of the farm. It is going to have an understandable identity crisis.

For this reason, you will want to do your generalized Sysprep after installing SharePoint & it's patches, but BEFORE doing your PSCONFIG. This will allow you to redeploy the image, set the computer name, a domain and then run PSCONFIG to join the server to the farm. On average this process will take about 15 or so minutes.

Here is how you actually will perform a generalized Sysprep:

1.) Get your image where you are happy with it

Patch your OS. Install the softwares that you want to be able to have already ready to go. I recommend checking out some of my other posts for helpful PowerShell scripts that you will want to run to help you with some of the base OS configurations that you will find useful. "Setup your development machine right" & "Track what you are doing in PowerShell" are two good examples of this.

2.) Take a snapshot of your VM

This will allow you to return to the operational state you are currently in when you finish Sysprepping the image.

3.) From command line run: "c:\windows\system32\sysprep\sysprep.exe"

clip_image001

4.) Choose the option to "Generalize the system"

This is going to remove the GUIDs from the registry and allow you to create new ones upon boot. This will also remove the license key information and require that you re-register with Microsoft when you use the image. This will allow sharing of an image with others without the fear of the licensing police coming after you.

5.) Choose the option to shut down the machine when complete

6.) Click Ok

7.) Once the VM is shutdown make a copy of the VM

It is a good idea to store this in a location that you going to remember what the VM is. It is also a good idea to rename the VM folder & files so that you know that this is a generic image. You will want to give the files a new name each time you redeploy them.

8.) Revert to your pre-Sysprepped snapshot

As previously stated, this will return you to where you were before you started this exercise with an image ready to deploy on.

I hope that this is as useful for you as it has been for me.

spflogging_32

1 - 10Next