2 ways to Generate an MD5 hash using Windows Built in tools

Powershell 4.0 and above include the Get-FileHash cmdlet which you can use to calculate the MD5 (among others) hash for a file.

If you don’t have Powershell 4.0, there are some other options to generate a hash.

Using the Certutil.exe command line tool

The Certutil.exe command line tool can be used to generate the MD5 hash of a file.

  1. Start an elevated command prompt
  2. Type the following command: certutil -hashfile [file] MD5
    Where [file] is the full path to the file.




Using Powershell

If you don’t have powershell 4.0, you can use the following commands:

  1. $algo = [Security.Cryptography.HashAlgorithm]::Create(“MD5″)
  2. $str= ([System.IO.StreamReader]”C:\temp\test.file”).BaseStream
  3. $b = $algo.ComputeHash($str)
  4. -Join ($b | ForEach {“{0:x2}” -f $_})
  5. $str.Close()




It would also be possible to use [System.IO.File]::ReadAlBytes and pass the output to the ComputeHash method, but ReadAllBytes will fail on files larger than 2GB.

When using a stream, you should be able to use files of all sizes.

Extract all solutions from SharePoint 2010 using Powershell

Using the following Powershell command, you can extract & save all solutions in SharePoint to your local drive:

(Get-SPFarm).Solutions | ForEach-Object{$var = (Get-Location).Path + “\” + $_.Name; $_.SolutionFile.SaveAs($var)}

This will extract all solutions to the current folder.

Update: If needed, you can use this script to add all the solutions to SharePoint (run it from the directory where the solutions are located)

Get-ChildItem | ForEach-Object{Add-SPSolution -LiteralPath $_.Fullname}

VS2012 – Proxy Authentication error when connecting to Team Foundation Services

If you are behind a Proxy server that requires authentication, you might receive a ‘407: Proxy Authentication Required’ error when trying to connect to Team Foundation Services.

In VS2010, you could work around this by opening the ‘start’ page in Visual Studio and enter your credentials when prompted, but this doesn’t work in VS2012.

For VS2012 follow the steps below:

  1. Go to Tools – Extensions & Updates
  2. On the left-hand menu, click ‘Updates’
  3. Click the link to enter your credentials
  4. Close the extension manager and connect to TFS.

Adding a ‘self’ linked SQL Server (SQL Server R2)

To mimic a multi-SQL Server environment of one of our clients on a single server, I needed to link the SQL Server to itself. If found several suggestions by googling it, but only this one worked for me:

EXEC sp_addlinkedserver @server=’alias’, –the name of the linked server
@datasrc=’.’,–the data source
@provstr=’Integrated Security=SSPI';

The other suggestions I found, used the same approach, but with a different provider. SQLNCLI worked for me.

Missing intellisense for aspx / masterpages in Visual Studio 2010 / SharePoint 2010 Projects

I’ve been working recently on a SharePoint 2010 project that I inherited from a colleague, and some of the aspx pages and the .master page did not have any intellisense, which was pretty annoying.

I’ve found this blogpost from Sanna Pehkonen, which states to simply open the page using the ‘View Markup’ option in the solution explorer (right click). And behold… intellisense is working again.

Update: Windows Search and Xml files (on Windows Server 2008)

A while ago, I wrote a blog post on how change how Windows indexed xml files (see: http://blog.sdbonline.com/2011/09/windows-search-and-xml-files.html)

The idea is to let Windows index Xml files as Text files, allow you to search on Xml element tags and attribute names (instead of only element values and attribute values):

Navigate to HKEY_CLASSES_ROOT\.xml\PersistentHandler and change the default value to {5e941d80-bf96-11cd-b579-08002b30bfeb}

See my previous post for a more detailed explanation

This works for Windows 7 and Windows 2008 (R2) (and also on Windows Vista), but for Windows Server 2008 (R2), you will need take a few additional steps:

Add the ‘File Service’ Role if not already added

Add the ‘Windows Search Service’ in the ‘Role Services’ of the ‘File Service’ Role.
Select the locations to index (this can always be modified afterwards)
Modify the registry and rebuild the index
Verify that xml files are now indexed using the ‘plain text filter’
go to ‘Control Panel’ – ‘Indexing Options’. Click advanced, and on the ‘File Types’ tab, verify that the xml extension is using the ‘Plain text Filter’
Make sure to wait for the indexer to complete: on my last test, my test file (in the root folder of my drive) didn’t get indexed until the end
Once completed, you can search for all the content in an xml files as it was a text file (e.g. element tag names will be found)
Note that you can do the same for other file type (e.g. xslt, xsl, …) by modifying the registry for those file types


and set the default value to {5e941d80-bf96-11cd-b579-08002b30bfeb}

ULSViewer tool not working on real-time logs

I use ULSViewer  a lot when debugging SharePoint issues. One of the nicest features of the tool is to view the SharePoint log in real-time (and the fact that is works for both SP2007 and SP2010).

Last time I wanted to use the tool, I found that it was not parsing the SharePoint log in real-time. I was however able to open individual log files.
As it turns out, ULSViewer is using *-????????-?????.log as a filter to parse the logs in real-time. I had some ‘older’ log files in the LOGS folder that were not formatted in the ULS format (from running powershell commands).
Removing these files from the SharePoint Logs folder got ULSViewer real-time parsing working again.

Requirements for SharePoint Groups when sending emails to them

I had a SharePoint designer workflow that send an email to a SharePoint group. In the History Log of the workflow, the follow message was logged:

The e-mail message cannot be sent. Make sure the outgoing e-mail settings for the server are configured correctly.

The outgoing email settings however were configure correctly (alerts and emails from other workflows were being send out).
There were actually two reasons why the emails weren’t being sent:
The settings ‘Who can view the membership of the group?’ on the group was configured as ‘Group Members’
The workflow is executed in the context of the current user. If the user has no access to view group membership, the workflow won’t be able to expand the group.
You should configure this settings as ‘Everyone’
The group had no permissions
The group should have at least ‘Read’ permission to the site. If the group has no permissions configured, you will receive the error as described above.

Configure hMailServer for SharePoint

Nice article from Wesley Bakker on how to use hMailServer for SharePoint: http://weblogs.asp.net/wesleybakker/archive/2010/08/09/configure-hmailserver-for-sharepoint.aspx

In Short:
SharePoint cannot authenticate to an SMTP server, so you need to disable authenctiaction on the hMailServer (at least for the local computer)

  • In Settings / advanced / IP Ranges add an IP range (either the ip of the server or simply – and disable ‘Require SMTP authentication’.

Drop folder
If you’re not using the build-in SMTP service, you need to configure SharePoint incoming mail to use a dropfolder. Also, SharePoint relies on the x-sender and x-receiver headers to process the mail. hMailServer does not add these messages, so these need to be added

  • Create a [dropfolder] and make sure the SharePoint Timer Service has read/write/modify access to it.
  • Configure hMailServer’s scripts (Settings / Advanced / Scripts) to handle the OnDeliverMessage event.
  • Use the following script
  • Sub OnDeliverMessage(oMessage)
        Dim path, filename, fso, original, copy
        path = Split(oMessage.Filename, “\”, -1, 1)
        filename = “[dropfolder]” & path(UBound(path))
        Set fso = CreateObject(“Scripting.FileSystemObject”)
        Set copy = fso.CreateTextFile(filename, True)
        copy.WriteLine(“x-sender: ” & oMessage.FromAddress)
        copy.WriteLine(“x-receiver: ” & oMessage.To)
        Set original = fso.OpenTextFile(oMessage.Filename, 1)
    End Sub

  • Configure SharePoint incoming mails to point to the [dropfolder]
  • Optionally configure hMailServer with a catch-all address (Domains / / Advanced tab) so you don’t have to create an account for each Email Enabled library you use in SharePoint.

The script will copy ALL emails to the dropfolder. Emails that are not intended for SharePoint will simple be ignored by SharePoint.