2007

Powershell in MOSS 2007 – Site Maps

So you have a client that’s running MOSS 2007. With the features and benefits of SharePoint 2013, it’s easy to get quickly frustrated with this old version of SharePoint. Nothing irks me more than forgetting about the lack of PowerShell, each and every time, and spending time looking up STSADM equivalent cmdlets to achieve the same task.

Isn’t there some way I can PowerShell SharePoint 2007?

Yes, but it kind of sucks. I would always recommend using STSADM commands natively when possible, but there really isn’t a good alternative to PowerShell sometimes. Windows SharePoint Services 3.0 and SharePoint Server 2007 do no include built-in cmdlets, but we can do the following if PowerShell is at least installed on the server:

1. Run the following to set the execution policy to allow for scripts to be run locally (this may or may not be reversed/denied via group policy:

2. Load the SharePoint API into you script with the following:

3. Load the MOSS 2007 Script Collection from CodePlex onto the machine HERE

4. Create a new PS1 file with the following format:

The above will run the two referenced PS1 files and keep them in memory preemptively to calling the cmdlets in the script later, and when they are, the console knows where to look for them.

The following can be done via native STSADM to create the same type of output (Note: the enumallwebs command is an STSADM command that is only available in SP ’07 SP2 and above):

Both of these options clearly will work, but the output will be different and some may prefer to stick to STSADM when possible in the older environments.

In the end, this is simply a workaround that allows you to run a small sub-set of your PowerShell scripts that you know and love from SP’13 and SP’10 over a MOSS2007 farm when STSADM commands just fall short.

SharePoint Feature GUID Identification

When working on a Sharepoint 2007 to 2013 migration, I had a need to identify SharePoint feature GUIDs in the 2007 farm to identify whether or not these items would be able to migrate to the new farm without issue. I had an application that provided documentation on each of the farms and identified all Site Collection features that were activated, but would output the resulting data with a list of these GUIDs rather than feature names.

Many features that come with SharePoint have GUIDs that you can reference by doing a quick google search for SharePoint Feature GUIDs. But for those custom features, I needed a way to pair these GUIDs with the feature names.

 

What to do?

When on the Site Collection you’re examining, go to Site Settings under the gear icon at the top right or Site Actions depending on what version of SharePoint you’re using:SiteSettingsSharePoint 2013 Site Settings

Navigate to Site Collection Features on the Site Settings page.SiteCollectionFeatures

You will then be given a page with a list of features activated, or available to activate, on that Site Collection. To find a specific feature’s GUID, click deactivate. Note: This will NOT deactivate the feature yet, you will be prompted with a confirmation screen before the feature is actually deactivated.

FeatureDeactivation

The next page will be the feature deactivation confirmation screen. We are not going to deactivate any features. The trick is that when you look at the URL on the resulting screen, it will contain the feature GUID with a FeatureID=<FeatureGUID> section in the URL:FeatureGUID