Powershell scripts for SharePoint 2010 services – ‘Stop & Start’

26 11 2009

We all now know that SharePoint 2010 is resource intensive, especially intensive with its ram usage.

I originally installed full blown SharePoint 2010 on my laptop (which has 4gb of ram) only to see most of that ram being used up and none left for visual studio to run.

I would recommend anyone who wants to install it on their workstation that only has 4gb of ram to install SharePoint Foundation instead which needs much less ram and will be fine for simple SharePoint 2010 dev or just playing around.

After I had installed it on my workstation I went on a search of some powershell scripts that I could use to stop SharePoint’s services when its not in use and start them up when needed.

It turns out Emmanuel Bergerat had created some and posted them on his blog, see here –

http://blogs.msdn.com/emberger/archive/2009/11/16/stop-and-go-with-sharepoint-2010-on-your-workstation.aspx

Thanks Emmanuel!

I have modified these scripts to work with SharePoint Foundation instead of full SharePoint Server 2010.

You can find the scripts on my SkyDrive – link at the bottom of the post.

To get them to work you will need to open them and edit the line –

‘MSSQL$SHAREPOINT’,"SQLWriter",’SQLAgent$SHAREPOINT’ | ForEach-Object

You need to change the name of the SQL Service (in my case MSSQL$SHAREPOINT) to the name matching yours. This name will depend on what your SQL instance is called, if you install SharePoint ‘standalone’ then it will most likely be the same as mine.

Run the scripts in the following order –

1. ‘Manual.ps1’ – Sets services to manual startup (Only need to run this once)

2. ‘Start.ps1’ – Starts SQL & SharePoint Foundation services

3. ‘Stop.ps1’ – Stops SQL & SharePoint Foundation services

Hope this helps! :-)

 

Link: SharePoint Foundation Powershell Scripts





How to: Install SharePoint 2010 ‘Standalone’ on Windows 7

23 11 2009

SharePoint 2010 Logo Since getting my hands on the Beta 2 version of SharePoint 2010 and SharePoint foundation I’ve read countless guides and blog posts about how to install it on Windows 7.

The problem is finding one that gives you the correct install procedure and this often means trawling through the comments to see if it is a reliable source. Because of this I’ve decided to post my own tutorial of the steps I used to create a reliable and fully functional SharePoint 2010 environment on a single machine (client OS).

Keep in mind that this blog post only walks through installing SharePoint 2010 in ‘Standalone’ mode (aka default configuration). This does not give you as much flexibility nor does it replicate a server farm environment. But this does work well for small dev work or to simply play around with SharePoint 2010.

*RAM Requirements: Be aware that if you are planning to install SharePoint Server 2010 you will need a lot of RAM. The recommended minimum from Microsoft is 6GB. SharePoint 2010 will install on a machine with 4GB of RAM but this will not be enough for a development environment.*

1. Install the Pre-Requisites for your operating system listed in the following MSDN guide -

http://msdn.microsoft.com/en-us/library/ee554869(office.14).aspx

2. Install the ‘WCF Hotfix’ (KB976462) for Windows 7/Server 2008 R2 which is available here –

http://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=23806

3. Extract the SharePoint installation (.exe) that you downloaded, you can do this by typing at the command line the following –

c:\SharePoint\SharePoint2010.exe /extract:c:\Temp

4. Next we need to edit an xml file and add an attribute that will allow you to install SharePoint on a workstation OS. If you try and run the setup without performing this step then it will display an error message that the OS is not supported.

SharePoint 2010 Setup Error

Open the ‘config.xml file located at ‘c:\Temp\files\Setup\config.xml’ (where Temp is the folder that contains your extracted files from above).

Add the following line inside the <configuration> tag:

<Setting Id="AllowWindowsClientInstall" Value="True"/>

Save and close the file.

5. Run the SharePoint 2010 setup (setup.exe).

6. When asked what type of installation you wish to perform select ‘Standalone’. This will install an instance of SQL Express and the default configuration. This will allow you to use local windows accounts.

SharePoint 2010 Installation Type

 image

7. Once the wizard has completed it will prompt you to run the ‘SharePoint Products Configuration Wizard’ (aka Psconfig). Do Not run the wizard and exit.

8. Install SQL Server 2008 cumulative update package 2 –

http://support.microsoft.com/kb/970315

image

9. When the above update has finished installing, execute the ‘SharePoint Products Configuration Wizard’. Ignore the warning telling you that installing SharePoint 2010 on Windows 7 or Vista is unsupported. You also need to click ‘OK’ to the message explaining that IIS will be reset as part of the installation.

image

image

The wizard will now configure SharePoint 2010 so you can sit back and relax! (Hopefully this step goes smoothly and you don’t see any errors).

10. When the wizard is complete, click ‘Finish’. An IE window should now popup and display a SharePoint page asking you to select the template you would like for your first SharePoint 2010 site collection.

SharePoint 2010 Central Administration

11. Success – the installation is now complete and you have a full working copy of SharePoint 2010 Beta! :-)





SharePoint 2010 & FIMSyncronizationService Problems

19 11 2009

**Updated 23/11/2009

Jeremy Thake (@jthake) advised me that this service is required for the ‘User Profiles Synchronization Service’ in SP2010 and that if you disable it then this won’t work. Decide whether you are going to need this feature before you disable this. I am not sure why it slows down the OS so much when booting up.

____________________________________________________________________________________

I recently installed the betas of SharePoint Foundation 2010  on top of Windows 7 and full SharePoint Server 2010 on to Server 2008 R2. One problem I found is that after you have rebooted the machine a couple of times it becomes very slow to startup.

At first I thought it was just because I was running SP2010 on a machine with only 4gb of ram and that was just the nature of the beast. When I opened Task Manager though it told a different story – the service ‘FIMSyncronizationService (Forefront Identity Manager Synchronization Service)’ was still trying to start and slowing the whole machine down. Once this service was stopped the machine continued booting into windows.

The service never seemed to start properly and I am assuming this is only needed if you want to use the full Forefront product with SharePoint.

I have now disabled this service using ‘Services.msc’ and SharePoint 2010 is still working fine. I would recommend anyone with the same issue who is not using Forefront to stop and disable this service from loading.

Hope this helps :-)





Getting started with Silverlight 3 and SharePoint

12 11 2009

Silverlight Logo Recently I have been focusing on creating some Silverlight charts using the ‘Silverlight Toolkit’ from Codeplex (see the link in the instructions below).

Once I had created my first chart I wondered how to get it to display in SharePoint. It seems there are a number of options for displaying a Silverlight application (xap) in a SharePoint web part.

I found lots of blog posts that described separate bits of configuring I needed to do to get Silverlight working happily in SharePoint. I’ve decided to create a getting started list of what you need to do to get Silverlight installed and how to display your xap file with the built in ‘Content Editor Web Part’. I have linked to other blog posts where necessary.

Configuration

1. Download and install the Silverlight 3 runtime from silverlight.net -

http://silverlight.net/getstarted/silverlight3/

2. Download and install the Silverlight 3 SDK and tools for Visual Studio from the silverlight site - 

http://silverlight.net/getstarted/

3. <Optional> Download and install the Silverlight Toolkit (If you want to use some of these cool and free Silverlight controls) -

http://silverlight.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=30514

4. If you are running Windows Server 2008 you can skip this step as the MIME types should have been automatically added to IIS7 for you. For server 2003 users you will need to add the Silverlight MIME types to IIS6, follow the instructions here -

http://blogs.technet.com/jorke/archive/2007/09/11/silverlight-mime-types-in-iis6.aspx

5. This step involves configuring the web.config files for the SharePoint sites that you wish to run your Silverlight applications in. Follow the instructions on this blog post -

http://blogs.msdn.com/steve_fox/archive/2009/03/11/amending-the-web-config-file-to-support-silverlight-development-on-sharepoint.aspx

6. Ensure that the assembly System.Web.Silverlight is in the global assembly cache. If not then you can find it at the following location -

C:\Program Files\Microsoft SDKs\Silverlight\v3.0\Libraries\Server

7. Configuration complete! – now read on to the deployment section

Deployment

To get your silverlight xap displaying on a SharePoint page follow the steps below. In terms of where to store your .xap file there are a number of places for you to choose. Some people recommend storing it in a folder called ‘ClientBin’ in the IIS virtual directory of the SharePoint web application but I was not able to get this working. I opted for the simplest method which was to store the file in a document library.

1. Upload your Silverlight xap file to a document library

2. Switch to edit mode for your SharePoint page and add a Content Editor Web Part

3. Insert the following HTML code - 

<!–<div width=”600px” height=”100px” id=”silverlightControlHost”>
<object data=”data:application/x-silverlight”, type=”application/x-silverlight-2″ width=”450″ height=”450″>
<param name=”source” value=”
http://yoursite/sites/charting/XAPs/SimpleSilverlightChart.xap”/>
<param name=”onerror” value=”onSilverlightError” />
<param name=”background” value=”white” />
<a href=”
http://go.microsoft.com/fwlink/?LinkID=108182″ style=”text-decoration: none;”>
<img src=”
http://go.microsoft.com/fwlink?LinkID=108101″ alt=”Get Microsoft Silverlight” style=”border-style: none”/>
</a>
</object>
<iframe style=’visibility:hidden;height:0;width:0;border:0px’></iframe>
</div> –>

Remember to remove the comments from the above code and replace the param value=”” with the url to your document library and xap file.

4. Click apply and save the changes to your content editor web part

5. If all went well you should be seeing your Silverlight application displaying correctly!

Note: You may need to play around with the width and height of both the <div> and <object> tags to size them correctly for your Silverlight application.

Good Luck! :-)





Microsoft Chart Controls for .NET – Error executing child request for ChartImg.axd

3 11 2009

I ran into this error today when attempting to show a web part on a SharePoint site that utilises the .NET 3.5 Chart Controls from MS (See link at the bottom of the post).

When the page opened it bombed out with the above error, some research found the following question on stackoverflow –

http://stackoverflow.com/questions/302820/net-3-5-chart-controls-exception-error-executing-child-request-for-chartimg-axd

To fix this error you need to add the following entry into the <HttpHandlers> section of the web.config file:

<add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />

When I refreshed the page, I received another error – this time it was:

Invalid temp directory in chart handler configuration

If you too get this error then you need to make sure you have the following line in the <appSettings> section of the web.config:

<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />

Also make sure that the above directory ‘TempImageFiles’ exists on the C: drive or you can change this to any other directory that you like.

Hope this helps! :-)

Download link for MS Chart Controls:

http://www.microsoft.com/downloads/details.aspx?FamilyId=130F7986-BF49-4FE5-9CA8-910AE6EA442C&displaylang=en





Pre-register for SharePoint 2010 beta

30 10 2009

logo

In case you haven’t seen this link floating around the web or on twitter yet then here it is:

http://sharepoint2010.microsoft.com/try-it/Pages/Trial.aspx

Simply head over the site and register, you will then be notified as soon as the public beta of SharePoint 2010 becomes available in November :-)





SharePoint – The Trial Period for this product has expired error

16 10 2009

I had this error message today when trying to create a report center site. After looking through the SharePoint logs I found the following lines:

Feature receiver assembly ‘Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’, class ‘Microsoft.SharePoint.Publishing.PublishingFeatureHandler’, method ‘FeatureActivated’ for feature ‘22a9ef51-737b-4ff2-9346-694633fe4416′ threw an exception: Microsoft.SharePoint.SPException: The trial period for this product has expired.     at Microsoft.SharePoint.Publishing.CmsSecurityUtilities.EnsureEvaluationNotExpired()     at Microsoft.SharePoint.Publishing.PublishingFeatureHandler.FeatureActivated(SPFeatureReceiverProperties receiverProperties)     at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce) 

Feature Activation: Threw an exception, attempting to roll back.  Feature ‘Publishing’ (ID: ‘22a9ef51-737b-4ff2-9346-694633fe4416′).  Exception: Microsoft.SharePoint.SPException: The trial period for this product has expired.     at Microsoft.SharePoint.Publishing.CmsSecurityUtilities.EnsureEvaluationNotExpired()     at Microsoft.SharePoint.Publishing.PublishingFeatureHandler.FeatureActivated(SPFeatureReceiverProperties receiverProperties)     at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce)     at Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, Boolean fForce) 

After some googling around I find the following blog post – http://blog.thekid.me.uk/archive/2007/02/05/activating-office-sharepoint-server-publishing-infrastructure-access-denied.aspx.

Changing the application pool account worked and the site was created, although I did have a ‘File not Found’ error first because I had forgotten to enable the ‘Office SharePoint Server Enterprise Site Collection features‘ feature in the top level site collection.

Hope this helps!





SharePoint STSADM backup to a file share

28 09 2009

I have been configuring STSADM backups today on a few SharePoint & WSS WFE servers to backup to a file share. These have been scheduled using the task scheduler and some batch files.

I had read before that the service account running the SQL instance would need modify permissions on the on the file share (both Sharing and Security permissions), and I am sure this is how we have it configured for another server.

However when I executed the backup it kept failing with the error message –

Object objectName failed in event OnBackup. For more information, see the error log located in the backup directory. SqlException: Cannot open backup device Operating system error 5(Access is denied.)

I did some searching around and eventually came across this TechNet thread –

http://social.technet.microsoft.com/Forums/en-US/sharepointadmin/thread/7a0100cf-f396-46e6-83e8-06bdb08b432e

It seems that modify permissions is not enough and that the SQL service account needs full control permissions on the file share. I changed the permissions to full control and hey presto the backup worked! :-)

Hope this helps.





Quest Migration Manager 2.0 now released

15 09 2009

Bit of a plug for Quest software here but their tool to migrate SharePoint subsite’s, site collections and content has now been fully released. This post is slightly late though as the official release was on the 6th August 2009!

The official page is here –

http://www.quest.com/migration-manager-for-sharepoint/

And this blog post by the quest team talks about some of the features –

http://sharepointforall.com/blogs/team/archive/2009/08/07/migration-manager-for-sharepoint-2-0-is-now-generally-available.aspx

Their previous version of the software was called the ‘Reorganization Wizard’, we ran into problems moving subsites around within our farm and this software came to the rescue.

I would urge you all to check it out as its packed full of useful functionality. :-)





SharePoint solutions do not retract

5 08 2009

I have had this problem on one of our servers for some time now and am still trying to figure out what causes it.

When you go to the ‘Solution Management’ screen of Central Administration and retract a solution (wsp) it seems to retract ok but the status of the solution remains ‘Deployed’. When you try and delete the solution in the GUI you then get an error saying that you must retract the solution first – but it is retracted!

To get round this you can run an stsadm command to physically delete the solution:

STSADM –o deletesolution –name ‘YourSolution.wsp’ –override

The override flag is needed to force the removal of the solution as SharePoint thinks it is still deployed even when it is retracted.

If anyone has any ideas of what the problem with the GUI might be or how I can solve it please let me know.

Hope this helps :-)