User Profile Synchronization Service–Hangs on Starting (I fixed it!)

I have several servers thankfully all of them are development servers that have this issue…

It happens a lot, and finally instead of creating a new server every time (and I have) I decided to fix the issue.

After several hundred hours of debugging, I finally decided to call Microsoft’s Premier Support. It was worth it in its entirety.

Here is what I was getting…


To resolve it do the following things:

  • Stop the User Profile Synchronization Service
  • Open IIS (inetmgr)
  • Click on the server name and select Authentication
  • Selected Anonymous Authentication then choose Edit
  • Click the specific user, then enter “IUSR”
  • Add the service account to Local Admin group on the server
  • Add the service account to all the FIM groups
  • add the service account to the WSS_WSP and WSS_Admin_WPG group
  • Perform an IISRESET
  • Create a new User Profile Synchronization Service Application
  • Started the User Profile Synchronization Service

Stop the User Profile Synchronization Service

First you have to start SharePoint PowerShell

  • Go to Start
  • Microsoft SharePoint 2010 Products
  • Right click on SharePoint 2010 Management Shell
  • Choose “Run as Administrator” from the context menu


Type in Get-SPServiceInstance then capture the GUID of the User Profile Synchronization Service as shown below


Now that you have the GUID, type in Stop-SPServiceInstance <GUID> as shown below…


Now your service is stopped…


…But we are not yet out of the woods… We have a lot left to go…

Open IIS (inetmgr)

Go to:

  • Start
  • Type in “inetmgr

Click on the server name and select Authentication

Click on your server host name, then double click Authentication


Selected Anonymous Authentication then choose Edit

Click on Anonymous Authentication then click Edit…


Click the specific user, then enter “IUSR”

Add IUSR to the specific user account


Add the service account to Local Admin group on the server

Go to:

  • Start type in “compmgmt.msc
  • Go to Local Users and Groups
  • Go to Groups
  • Double Click Administrators


Add the service account to your computer


Click “OK” then keep the Computer Management window open

Add the service account to all the FIM groups

Do the exact same to all of the FIM groups as you did above


Add the service account to the WSS_WSP and WSS_Admin_WPG group

Again, do the same as you did above but for all the WSS_WSP and WSS_Admin_WPG groups


Perform an IISRESET

Go to:

  • Start
  • Type in “cmd
  • In the command shell type in “IISRESET”

    Create a new User Profile Synchronization Service Application


    Choose User Profile Service Application


Add the following fields (I added 2 to any of the database table names as shown below)


Click Create

Perform an IISReset

Make sure you can get to this new application with out errors.

It is very important that you can access this and that you know you can at this point.

If you can not, then you will have to do further trouble shooting…


Note: If still unable to get to the User Profile Application…

If you are still unable to get to the User Profile Application service, you will want to check one more thing. That is to ensure that your WCF services are still running in IIS Manager, you will need to make sure the site has been started


Perform another IISReset then try again.

Open ULS Log Viewer to get ready…

At this point in time, you will want to be ready to start tracing the User Profiles logs…

In ULS Log Viewer, right click on the log area and choose Filter by Item.

Then choose Category and type in “User Profiles”. This will allow you to filter out only what you need at this point.


Started the User Profile Synchronization Service

Now you must restart your service with the new user profile synchronization service application that you just created.

  • Navigate to Central Admin again
  • Under System Settings, choose Manage Services on Server


  • Click on Start under User Profile Synchronization Service
  • image

  • Enter your system account’s password twice
  • Click OK


  • Now in the ULS Log Viewer you will notice the following, this is good, it is rebuilding the FIM configuration (formally called ILM, but SharePoint never updated the name)


And if you did everything correctly then you should see everything running as it needs to be:


Don’t forget to configure your MySite information in the new User Profile Service Application you created.

You will need to re-run all of your profile synchronization.

Let me know if this has helped you!

Google to shut down Meebo and here are some alternatives

Popular instant messaging service Meebo to be shutdown by Google by July 11th. As you know, Meebo was aquired by Google a few days back, and now they announce that they’ll be shutting down most of Meebo services, except the Meebo bar. Google has been doing this lately, shutting down Picnik and other not so popular Google services, to concentrate more on Google+.

Update: You can download all your chat logs on Meebo from this link.

Here are a few services you can try out if you miss the Meebo messenger. All these messengers work have web clients, just like Meebo does.


In my opinion (no, that wasn’t a pun), is one of the best web-based messengers out there. They do have mobile apps supporting all the major platforms, but their web client keeps it apart from others. The web client lets you IM, video chat (also voice chat), transfer files, and even access chat history. It supports a big list of IM services, from Gtalk to Steam.


2. Nimbuzz

Besides IM, you can also make low-cost international calls in Nimbuzz, both on mobile and desktop. They have recently released their API, which lets developers make automated chat buddies – this feature may be integrated in the next version of Nimbuzz, and its apps. They also have a Chrome app, in case you use Google Chrome.

Link: Nimbuzz

3. eBuddy

If you want to more control over your web messenger, you should consider trying eBuddy’s web client. They also have eBuddy XMS, which is eBuddy for mobile. Like Facebook Messenger, eBuddy XMS will let you know if your message is read.

Link: eBuddy

4. Trillian

Trillian has a nifty feature which lets you update your status of different social networks right from the messenger, that includes Facebook, Twitter and many more. It lets you customize using themes and a bit more.

Link: Trillian

5. IM+

Not as popular as previously mentioned messengers, but worth a try if you’ve already tried the rest of them, has a handy auto away feature.

Link: IM+

Try out the apps, and tell us which one you’d prefer to use.

— This Post Google to shut down Meebo and here are some alternatives is Published on Devils Workshop .

SharePoint Search: Partial Page Exclusion

Out of the box, SharePoint provides a mechanism for excluding publishing pages from the search index by any number of criteria, but what if you want to exclude only parts of a page?  This becomes useful when you have content on numerous pages that contains common keywords. 


For Example, In Our Production site we have master page and in this master page , Header , Left Navigation and footer for the Pages.


So when someone performs a search for “Careers” they will get back every page in your site, instead of just the Careers and related Careers pages.  To prevent this, we needed a way to keep SharePoint from indexing that content when it’s performing a crawl.

Web Control

We decided that a System.Web.UI.WebControls.Panel control would be a good model to build my control on.  It allows you to easily drop it in the page layout using SharePoint Designer, and you can put other html and controls within it.  I didn’t want to inherit from the Panel control though, because it adds unwanted ‘div’ tags to the rendered output.  The key to the Panel control’s behavior are the following two attributes on the class: [ParseChildren(false), PersistChildren(true)].

These attributes allow the content within the control to persist as controls and not properties of this control. 

User Agent

The second part of the equation is knowing when to show or hide the contents of the web control. 

SharePoint gives us a way to identify that it’s performing a crawl through the UserAgent property of the http request by adding “MS Search” to it. 


Putting this all together we come up with the following class:

    [ParseChildren(false), PersistChildren(true)]
    public class SearchCrawlExclusionControl : WebControl
        private string userAgentToExclude;

        public string UserAgentToExclude
                return (string.IsNullOrEmpty(userAgentToExclude)) ? "ms search" : userAgentToExclude;
                userAgentToExclude = value;

        protected override void CreateChildControls()
            string userAgent = this.Context.Request.UserAgent;

            this.Visible = (!string.IsNullOrEmpty(userAgent)) ? !userAgent.ToLower().Contains(UserAgentToExclude) : true;



Using It

Register Web Control within Page.

<%@ Register Tagprefix="JDSUWebControls" Namespace="ABC.SharePoint.WebControls" Assembly="ABC.SharePoint, Version=, Culture=neutral, PublicKeyToken=xxxxxx" %>

After adding the register tag to the page layout, we can wrap all the content we want to exclude with our control:

<SearchUtil:SearchCrawlExclusionControl ID="SearchCrawlExclusionControl1" runat="server">

    <div>Some Content To Exclude</div>



Test this:

After applying this User control to all your excluding Div and HTML tags.

Make Incremental or Full crawl of you web site.

How to edit the User Agent string in Mozilla FireFox

To change the User Agent string, just enter about:config as an address in the address bar of FireFox, the location where you normally enter a URL (link). I recommend to preserve the original value, which you can get when you enter just about: in the address bar.

Now press the right mouse button to get the context menu and select "String" from the menu entry "New". Enter the preference name "general.useragent.override", without the quotes. Next, enter the new User Agent value you want Mozilla Firefox to use.

I added my name and a link to my web site to the original value. You can also pick one from the list of User Agent strings. Check the new value by entering about: in the address bar.


How to edit the User Agent string in Google Chrome

Here's how to change the user agent:

1. open the Developer Tools (Ctrl+Shift+I on Windows/Linux, Command – Option – I on Mac OS X)
2. click the "settings" icon at the bottom of the window
3. check "override user agent" and select one of the options (Internet Explorer 7/8/9, Firefox 4/7 for Windows/Mac, iPhone, iPad and Nexus S running Android 2.3). You can also select "other" and enter a custom user agent.

Note: Here to test for SharePoint search write MS Search as User Agent in Other option.


How to edit the User Agent string in Internet Explorer

To change it open your registry and find the key

[HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionInternet SettingsUser AgentPost Platform].

Each value name listed in this key will be sent to the remote web server as an additional entry in the user agent string. To remove any additional information delete the values within the [Post Platform] key. To add additional entries create a string value and name it the string you want to be sent.

Restart Internet Explorer for the changes to take effect.

Note: Here to test for SharePoint search write MS Search as User Agent in Other option.


Save Gmail Attachments to Google Drive with One-Click”

Posted: 05 Jun 2012 07:39 PM PDT

I like using Google Drive a lot more because of things like backing up my photos from my Android to Google Drive drive (which even Dropbox can do). I also use a host of Google related services has meant I have started adopting Google Drive a lot more.

In a way a lot of people are already on Google Drive if they are using Google Docs. But Google Drive allows any type of file to be saved which makes it ideal to download attachments from my Gmail account.

I use Chrome and found Gmail Attachments to Drive extension very useful.

Features of Gmail Attachments to Drive

If you are using Chrome, simply install the extension. Simply sign-in to your Gmail account and look up an email which has a file attached to it.

As you can see in the image below, you will get a new option to ‘Save to Drive’ for the file..

It basically opens the web interface of your related Google Drive account to download it. Ideally I would suggest making a specific folder to move your downloaded attachements into to keep your Google Drive neat and organized.

I have been using this extension for a couple of days and unfortunately could not find a similar one for Firefox. If you do come across any Firefox add-on that does the same, do drop it in comments.

Link: Gmail Attachments to Drive – Chrome

Related posts:

— This Post Save Gmail Attachments to Google Drive with One-Click is Published on Devils Workshop .

Fwd: SharePoint 2010 Deployment: Powershell Script

Pre-SharePoint 2010 developers are familiar with Stsadm command. The general scenario of SharePoint 2007 deployment is to develop a batch file with stsamd commands. A generic deployment includes the following steps:

  • Deactivate Features
  • Uninstall Features
  • Retract Solution
  • Delete Solution
  • Add Solution
  • Deploy Solution
  • Install Features
  • Activate Features


SharePoint 2007 Deployment Script:

I’ll first describe how stsadm command file looks like implementing the above steps. You can put the following script in a batch file and then clicking on the batch file in SharePoint server, will deploy the solution. The solution and the batch file need  to be in the same folder. The first line of the script (cd /d %~dp0) will change the current directory to the script directory.

--Change script directory to current directory   cd /d %~dp0   @SET STSADM="c:program filescommon filesmicrosoft sharedweb server extensions12binstsadm"   @SET SITEURL="http://localhost"     echo Deativating 'MyFeature' feature.   %stsadm% -o deactivatefeature -name MyFeature -url %SITEURL% -force    echo Uninstalling 'MyFeature' feature.   %stsadm% -o uninstallfeature -name MyFeature -force      echo Retracting solution 'MySolution.wsp'   %stsadm% -o retractsolution -name MySolution.wsp -immediate -allcontenturls %stsadm% -o execadmsvcjobs    echo deleting solution 'MySolution.wsp'   %stsadm% -o deletesolution -name MySolution.wsp -override      echo adding solution 'MySolution.wsp'  %stsadm% -o addsolution -filename MySolution.wsp    echo deploying solution 'MySolution.wsp'   %stsadm% -o deploysolution -name MySolution.wsp -url %SITEURL% -immediate -allowGacDeployment -force   %stsadm% -o execadmsvcjobs      echo Installing 'MyFeature' feature.   %stsadm% -o installfeature -name MyFeature -force    echo activating 'MyFeature' feature.   %stsadm% -o activatefeature -name MyFeature -url %SITEURL% -force    iisreset /restart /noforce /timeout:60 

File: SharePoint 2007 Script for Deployment


PowerShell Scripting Basic, every SharePoint Developer Should Know

In SharePoint 2010 stsadm is supported but powershell commands are recommended to use. To know how to run SharePoint powershell script, let’s get an overview of PowerShell. I’ll try to provide a gist on Powershell so that you can write your own Script for SharePoint. As as SharePoint developer we don’t need to be expert in PowerShell script but we need to know the basic syntax.

 PowerShell command format: Powershell command has two parts: verb and noun. For example, to get current date, you need to execute command get-date. Here get is verb then a hyphen(-) and finally date which is noun. Powershell is not case sensitive. But its good practice to use Caml case in command. The following command uses verb-noun format to get current date.


Get Help on PowerShell Command: To get help for a command you can use Get-Help command. The following command is used to get help on Get-Date:

Get-Help Get-Date

You can even type the verb part including hyphen and then press tab. You’ll then get the all commands starting with the verb.

PowerShell command execution Permission: Before you execute any command, you need to enable PowerShell to execute command. You can get the current execution policy by running the following command:


The result of the command might be one of the followings:

  • Restricted
  • AllSigned
  • RemoteSigned
  • Unrestricted
  • Bypass
  • Undefined

To execute command or run scripts, you can set execution policy to ReomteSigned but based on your security consideration, you can use different options. To set execution policy, you can run the following command:

Set-ExecutionPolicy RemoteSigned

Run a PowerShell Script: To run a PowerShell script, you need put the file name in the PowerShell command prompt. But there are few conventions/restrictions that you need to follow.

  • To run a script file you need to type complete path of the script file. The complete path may be in the form ‘.foldersubfolderscript.ps1’ or a full path like ‘c:foldersubfolderscript.ps1’
  • To execute a script you need to use the format of & ScriptPath format. If the file path has space then use double quotation to enclose the path. So to execute a file you can use the command like below:

& “C:My ScriptsScript.ps1”

  • If you want to run PowerShell script from Run window then you can do so by putting the following command in Run window:

Powershell –NoExit & ‘C:My ScriptsScripts.ps1’

One thing to remember in the above script is that single quote is used instead of double quote when you will run the above command from Run window. Single quote must be used for file path if the file path has space. Double quote will not work in this case.

  • Variables in PowerShell are identified by putting a  $ prefix. You’ll find how the variable is used in the section “A Sample PowerShell Script”
  • PowerShell script file is saved with extension .ps1

A Sample PowerShell Script:

Let’s say you have a PowerShell script (as shown below) in a file named script.ps1. Now You want to run the following powershell script (in a file Script.ps1) from Run window. The script will add two numbers and print the output.

echo 'setting a value for a'  $a=5  echo 'setting a value for a'  $b=3  echo 'adding a and b'  $c=$a+$b  echo "reslut is $c"

The variables in the above script are prefixed by $. Take a close look at the last echo. The echo has a $c in the double quotation. Remember, you can refer a variable name in double quotation string (as in the last echo in the above script). But the same is not true for single quote. If you would use the $c inside single quote then it would print back the $c. Single quote is considered as literal string in PowerShell.

SharePoint 2010 Deployment

In SharePoint 2010, you can use PowerShell script for deploying SharePoint solution/features. Let’s first take a look at how the deployment script will look like

PowerShell Deployment Script: Deployment in SharePoint 2010 still has the same eight steps (Deactivate Features, Uninstall Features…..) as described at the beginning of this post. The following script deploy a solution:

function WaitForJobToFinish([string]$SolutionFileName)  {       $JobName = "*solution-deployment*$SolutionFileName*"      $job = Get-SPTimerJob | ?{ $_.Name -like $JobName }      if ($job -eq $null)       {          Write-Host 'Timer job not found'      }      else      {          $JobFullName = $job.Name          Write-Host -NoNewLine "Waiting to finish job $JobFullName"                    while ((Get-SPTimerJob $JobFullName) -ne $null)           {              Write-Host -NoNewLine .              Start-Sleep -Seconds 2          }          Write-Host  "Finished waiting for job.."      }  }    Add-PsSnapin Microsoft.SharePoint.PowerShell     $CurrentDir=$args[0]  $solutionName="Limeco.UI.WebParts.wsp"  $SolutionPath=$CurrentDir + ""+$solutionName      Write-Host 'Going to disable feature'  disable-spfeature -identity Limeco.UI.WebParts_LimecoWebPartFeature -confirm:$false -url http://localhost     Write-Host 'Going to uninstall feature'  uninstall-spfeature -identity Limeco.UI.WebParts_LimecoWebPartFeature -confirm:$false -force     Write-Host 'Going to uninstall solution'  Uninstall-SPSolution -identity $solutionName  -allwebapplications -confirm:$false    Write-Host 'Waiting for job to finish'  WaitForJobToFinish     Write-Host 'Going to remove solution'  Remove-SPSolution –entity $solutionName -confirm:$false     Write-Host 'Going to add solution'  Add-SPSolution $SolutionPath     Write-Host 'Going to install solution to all web applications'  Install-SPSolution –entity $solutionName –llwebapplications –ACDeployment    Write-Host 'Waiting for job to finish'   WaitForJobToFinish     Write-Host 'Going to enable Feature'   Enable-spfeature -identity Limeco.UI.WebParts_LimecoWebPartFeature -confirm:$false -url http://localhost     Remove-PsSnapin Microsoft.SharePoint.PowerShell  

File: Myscript.ps1

The first thing in the above script is a function WaitForJobToFinish which is used to make sure jobs are finished executing before moving on. This method is similar like the command ‘stsadm –o execadmsvcjobs’ in SharePoint 2007. In the above script, the line ‘Add-PSSnapin’load the SharePoint PowerShell script. If you already using SharePoint 2010 Management Shell (Which is a PowerShell extension already) then this line should be removed. In the above script Write-Host is just like print function that print a string in the console. FYI, when you pass arguments to an PowerShell script, the arguments are kept in a PowerShell variable $Args. You can access any arguments by assessing it $Args[index]. I think the command in the above script is self-explanatory. The –confirm:$false is for not to prompt user for confirmation. In the above script you need to pass the solution directory.
Automate the Deployment Script: To automate the powershell Script you need to put the above script in a PowerShell scipt file(having ps1 extension). Let’s say you have you script in a file named as myscript.ps1. Now you need to run the script you need a batch file which will execute the script file. The script file may be like one shown below:
cd /d %~dp0  powershell -noexit -file    ".MyScript.ps1" "%CD%"
 File: MyCommand.bat

In the above command, the first line change the current directory to the location from where the batch file is run. Then I have run the PowerShell with the MyScript.ps1 file and passed the current directory as argument (%CD%)



I think stsadm command was simple and easy to use. PowerShell is too much powerful and extensible. You can do almost all kinds of SharePoint programming with PowerShell script. My personal view is that we, SharePoint developers, don’t need to be expert in PowerShell but we need to have basic knowledge of “How to use PowerShell Script for SharePoint Deployment/Maintenance?”. There are already much activities on web around PowerShell and SharePoint. Few useful links related to PowerShell and SharePoint are given below:

Some Useful CodePlex links:

Here is a Visual Studio 2010 extension for SharePoint PowerShell Scripting:

Here is a tool called PowerGui that is handy for editing PowerShell script:

The concept for waiting for job to finish, I have taken from the following link:

Posted by Sohel Rana at 10:12 AM 6 comments

Sigar V. Dave
B.E. Computer