Archive for November 25, 2010

SharePoint 2010 Developer Dashboard

Enabling the developer dash board in SharePoint 2010

On the SharePoint 2010 server in question run CMD or SharePoint 2010 Management Shell as Administrator and type the below command

Stsadm –o setproperty –pn developer-dashboard –pv ondemand

This will enable the very awesome developer dash board.  The icon  will be present in the top right hand corner of your SharePoint 2010 site, clicking it once will open the dashboard below your site and clicking it again will remove the dashboard from the site.

I have seen a few posts on this but the one below is very good and looks at the options from a Developers point of view.

http://blogs.technet.com/b/speschka/archive/2009/10/28/using-the-developer-dashboard-in-sharepoint-2010.aspx

Post to Twitter

Space requirements for SharePoint 2010 upgrade method

Action 4.0.98.0 of Microsoft.SharePoint.Upgrade.SPContentDatabaseSequence failed to rollback.

The above error was received while doing a 2007 to 2010 database attach method.

The issue was that the space on the SQL drive where the MDF and LDF are located had run out of space.  The database that I was trying to restore was 39GB and the space on the drive was 100GB.  So note to self, ensure one has at least double the space requirement to satisfy the MDF file alone, the LOG file is going to be approximately a third of that file during the upgrade.

The event log does mention this.

“Examine the drives containing the specified databases’ log and data files.  Free space on these drives or move the database files to another drive.  A drive should have enough free space for the largest database file on it to autogrow twice. For more information about this rule, see “http://go.microsoft.com/fwlink/?LinkID=163560”.”

Post to Twitter

Hack SQL 2008 R2 Sysadmin permissions

Well it’s not really a hack now is it, but it sounds way cool!

What happens in SQL 2008 R2 is that sysadmin rights are not automatically given to the local administrator of the machine.  This has caused some issues for those who require sysadmin access and didnt setup the SQL instance.  So what do you do if you need sysadmin rights, and you are a local admin?

  • Open command prompt as Administrator
  • If you have default instance run following command on command prompt to stop SQL service: “net stop mssqlserver”
  • Now go to the directory where SQL server is installed. In my case the directory is “C:Program FilesMicrosoft SQL ServerMSSQL10_50.MSSQLSERVERMSSQLBinn”. So need to run CD C:Program FilesMicrosoft SQL ServerMSSQL10_50.MSSQLSERVERMSSQLBinn.
  • Now run the following command to start SQL server in single user mode. As we have specified “SQLCMD”, now only SQLCMD connection can be made.

sqlservr -m”SQLCMD”

  • Now open another command prompt window and write command SQLCMD
  • Run following two commands, remember to change DOMAINUSERNAME for the user you are currently logged in as

create login [<<DOMAINUSERNAME>>] from windows; 

EXEC sys.sp_addsrvrolemember @loginame = N'<<DOMAINUSERNAME>>’, @rolename = N’sysadmin’; 

GO;

  • Go back to first command window and press Ctrl+C to stop the SQL server and then type ‘Y’ for confirmation. This will stop the SQL server.
  • Start SQL server again and no startup parameters need to specified this time.
  • Login as the user that you are logged in with using SQL Server Management Studio

Credit where credit is due.

How to access a newly installed SQL Server 2008 R2 instance if you do not know the login and password

Post to Twitter

The RIP STSADM statement is not completely true

Tired of running STSADM.EXE from the SharePoint Hive (C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14BIN)? 

With SharePoint 2010 you can use STSADM.EXE anywhere while using SharePoint 2010 Management Shell

Post to Twitter

SharePoint RSS feed for Google Alerts

Google alerts can be used in an awesome way to display current news topics that contain specific search phrases in a SharePoint RSS feed.  This can be used to show fresh and up to date dynamic content on a SharePoint site.

Simply go to http://www.google.com/alerts (And sign in with your Google account)

Update the search terms, type and volume.  Change the Deliver to “Feed”

 

Click Create Alert

Click RSS Feed and Copy the URL

Add the URL to a SharePoint RSS viewer web part and watch as Google works for you!

If you don’t like the HTML code in the RSS feeds or dislike the Google Alerts header use my custom XML code available here to neaten up the appearance.

Post to Twitter

How to Uninstall IE9 Beta

There is a good reason to install IE9 Beta and then there is a good reason to uninstall it. I feel the reason to uninstall it has far more worth than the reason to install it, so if you have IE9 running on your machine and things are not working out here is how to remove it.

Control Panel > Programs > Uninstall Program

On the left hand side panel select “View installed updates”

And from the list that is propagated find Microsoft Internet Explorer 9 and remove it.

It will require a reboot.

Post to Twitter

Multiple HTTPS sites in IIS

A client will one day ask you to ensure that all SharePoint sites are secure and that the communication is encrypted.  You will then suggest that all sites should be using a SSL certificate and run under HTTPS.  Everyone is happy you get the job signed off you log a change control and create your first HTTPS site and everything is looking peachy however when you create the next HTTPS site IIS complains that you already have an HTTPS site.  You can either panic, spend hours on goggle and then explain to your client the next day that your project manager dropped the ball or ….

C:InetpubAdminScripts>cscript.exe adsutil.vbs set /w3svc/<site identifier>/SecureBindings “:443:<host header>”

Run the above in command prompt for each site you have created as an HTTPS in SharePoint and as long as the host header is unique you will be able to run multiple HTTPS sites concurrently.

Post to Twitter

SharePoint AD FBA

I have recently had to create an a web application to use FBA (Forms Based Authentication) using AD (Active Directory).  I know a few people would ask me why I would do such a thing as NTLM already does this but its a nice way to setup FBA without a lot of work and in theroy it could work for alternative domains in stead of using a trusts.

First things first.

Extend your web application from Central Administration by completing the following steps

Application Management > Create or extend Web Application > Extend an existing Web Application

Select your web application and Create a New IIS web site using all the default settings and click OK

Once the site has been created goto Application Management > Authentication Providers

From the drop down list select your web application and click on the Zone you have just created (Most likely Intranet).

Change authentication Type to Forms

Change Membership Provider Name to ‘ADAuth’ and hit Save

Now create a local domain service account and name it SSOservice and use password P@ssw0rd

Add the following entry into the Primary sites web.config located in C:InetpubwwwroootwssVirtualDirectories<Web App Name>

Add the entry at the end of the config between </system.web> and </configuration>

Change domaincontroller.domain.com to your domaincontroller FQDN
Change OU=MnanagedStructure to your OU from AD
Change DC=Domain to your domain
Change DC=Com to your prefix
Change connectionUsername= to your username created above
Change connectionPassword= to your password created above

<connectionStrings>
<add name=”ADConnectionString” connectionString=LDAP://domaincontroller.domain.com/OU=Managed Structure,DC=domain,DC=com />
</connectionStrings>
<system.web>
<membership defaultProvider=”ADAuth”>
<providers>
<add name=”ADAuth” connectionStringName=”ADConnectionString” connectionUsername=”domainssoservice” connectionPassword=”P@ssw0rd” attributeMapUsername=”UserPrincipalName” type=”System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” />
</providers>
</membership>
</system.web>

You will need to add your FBA users to your web application with the appropriate rights.

Voila!  You should now be able to navigate to your extended web application using FBA

*note you can change attributeMapUsername=”UserPrincipalName” to query a number of AD objects instead of PrincipalName eg sAMAccountName

Post to Twitter

SharePoint manual user import via STSADM

When one adds a user to AD and they are not yet available in SharePoint people picker, you will need to run the below command to force a manual crawl using STSADM.
This might not be something new but never the less something that is a need to know for all SharePoint Administrators.
*This is also a good way to force a crawl of a remote trusted domain

stsadm -o setproperty -pn peoplepicker-searchadforests -pv “domain:mydomain.com,user,password”

or

stsadm.exe -o setproperty -url http://server:port -pn “peoplepicker-searchadforests” -pv “forest:foo.corp.com;domain:bar.foo.corp.com”, LoginName, P@ssword

Post to Twitter

SharePoint 2010 Upgrade from SharePoint 2007 Attach DB method

Everyone is talking about upgrading from SharePoint 2007 to SharePoint 2010 and what is the best way to do this?

Well the answer is not straight forward, you need have a lot of information on the current environment, planning, understanding, planning, resources and uhm planning.  Then you will be able to either do an in place upgrade, a database attach upgrade or a combination of the two.

In this post I will briefly cover the attach database upgrade method.

Basically this method is a little more subtle than the in place upgrade and can be slightly more tedious but a lot safer.

Firstly you create a new SharePoint 2010 server built on Windows 2008 x64 using SQL 2008 x64.  You can find the list of prerequisites here http://technet.microsoft.com/en-us/library/cc262485.aspx.  However the SharePoint 2010 package does come with a checker that you can run before installing 🙂

You will now need to make a backup of the SharePoint 2007 SQL content database of the web application you are trying to upgrade and Restore this backup to your SQL 2008 x64 server (I will refer to this server as 2008SQLServer) you are using for SharePoint 2010. (I will refer to the restored database as MOSS2010_Content_Demo)

To ensure your upgrade will be successful you will need to run the following Powershell command and work your way through the expections. You need to use SharePoint 2010 Management Shell to execute this command.  It will output a pretty HTML document located at C:upgrade.html

Test-SPContentDatabase -name MOSS2010_Content_Demo -WebApplication http://2010demo.local -ServerInstance 2008SQLServer convertto-html > C:upgrade.html

You will need to review this list fix the items on SharePoint 2007 and SharePoint 2010, once this has been done backup and restore the SQL database and run the command again.

Everything done?  GOOD!

Your machine is up and running and you have created a new Web Application (I will refer to this app as http://2010demo.local) please remove the current Database attached to your web application. You can do this by going to Databases under Applcaition Management and click on Manage Content Databases. From this area you will be able to remove the content database selected.

Now your Web Application has no database to point to!! Don’t panic we will assign a new database.

Run the following command and replace the obvious.

stsadm -o addcontentdb -url http://2010demo.local/ -databasename MOSS2010_Content_Demo

This should kick off the upgrade process.  Once completed it will leave you with a log file file and hopefully a successfully upgraded SharePoint 2010 site.

Post to Twitter