Mukesh Parmar

This user hasn't shared any biographical information


Posts by Mukesh Parmar

The Communicator is SharePoint Police Now!

Mukesh Parmar - SharePointPoliceYes! You read it right The Communicator is SharePoint Police Now. Few reasons for changing the domain name

1. Few days back Google pulled subdomains from search, and as a result will no longer appear under Google search results. Read More

2. C’mon who doesn’t want a .com domain name?

Note: I have tried my best to keep all the existing links pointing to intact. They will be automatically replaced by SharePointPolice. My request to all of you, if you find any broken links do let me know via the contact page. Will try to fix it as soon as possible.


I’m Awarded The Microsoft Community Contributor Award 2011

Got an email from Microsoft today morning

Dear Mukesh,

Congratulations! We’re pleased to inform you that your contributions to Microsoft online technical communities have been recognized with the Microsoft Community Contributor Award.

The Microsoft Community Contributor Award is reserved for participants who have made notable contributions in Microsoft online community forums such as TechNet, MSDN and Answers. The value of these resources is greatly enhanced by participants like you, who voluntarily contribute your time and energy to improve the online community experience for others.

I’m really happy & excited for being awarded the Microsoft Community Contributor Award 2011 and the excitement does not stop here, I’m also one of the first people to receive this award since its launch.

Hey, you know what ? This is no Show Stopper, I’ll continue to provide my support and contribution to the community as and when possible. ;)

Additional information about the Microsoft Community Contributor Award Program can be found at

A Big Thanks to Microsoft for the Recognition!


Automated PowerShell Script to backup SharePoint Farm or Site Collection with email Notification

In today’s fast paced environment, we really like most of our things to be automated and at the same time get an alert on how things are going, so we can take necessary steps as required. Administering a SharePoint 2010 farm is no different, and as a day to day activity we have to take periodic backups of the entire farm or a particular Site Collection and at the same time be prepared for disaster recovery if required.

I have prepared a small yet powerful PowerShell script for taking a backup of the entire SharePoint 2010 farm and at the same time notifying you via email the outcome of the Script i.e. Was the backup successful or did it fail and the reason why it failed.

Let’s Start

# ==============================================================================================
# NAME: SP2010_Farm_Backup_With_Notification.ps1
# AUTHOR: Mukesh Parmar
# DATE: 07 December 2010
# COMMENT: A Powerful Script to take backup of the entire SharePoint 2010 Farm with email notification.
# Website:
# ==============================================================================================
Add-PsSnapin Microsoft.SharePoint.Powershell –ErrorAction SilentlyContinue
  $today = (Get-Date -Format dd-MM-yyyy)
 #Location of the Backup Folder
 # This will actually initiate the SPFarm backup.
  Backup-SPFarm -Directory E:\Backup\DailyFarmBackup\$today -BackupMethod full
 # Edit the From Address as per your environment.
  $emailFrom = ""
 # Edit the mail address to which the Notification should be sent.
  $emailTo = "Admin@SharePoint.Com"
 # Subject for the notification email. The + “$today” part will add the date in the subject.
  $subject = "The SharePoint Farm Backup was Successful for "+"$today"
 # Body or the notification email. The + “$today” part will add the date in the subject.
  $body = "The SharePoint Farm Backup was Successful for "+"$today"
  # IP address of your SMTP server. Make sure relay Is enabled for the SharePoint server on your SMTP server
  $smtpServer = ""
  $smtp = new-object Net.Mail.SmtpClient($smtpServer)
  $smtp.Send($emailFrom, $emailTo, $subject, $body)
  $ErrorMessage = $_.Exception.Message
  # Configure the below parameters as per the above.
  $emailFrom = ""
  $emailTo = "Admin@SharePoint.Com"
  $subject = "The SharePoint Farm Backup Job failed on "+"$today"
  $body = "The SharePoint Farm Backup Job failed on "+"$today and the reason for failure was $ErrorMessage."
  $smtpServer = ""
  $smtp = new-object Net.Mail.SmtpClient($smtpServer)
  $smtp.Send($emailFrom, $emailTo, $subject, $body)

A brief on the execution of the above script

  1. First it will get the current system Date in dd-MM-yyyy format [07-12-2010].
  2. It will create a folder with Current Date as the name in the following location E:\Backup\DailyFarmBackup\
  3. Next step will be to start SharePoint 2010 Farm backup procedure in the newly created folder.
  4. Once the backup is complete it will send a notification email to the email address mentioned in the $emailTo field.
  5. If the backup fails for some reason, you will receive an email containing the reason why the backup failed.

You can download the above script & the another one for backing up the Site Collection from the following locations



Rename the above files extension from .txt to .ps1


  • Once you have configured the script as per your environment, create a new task in Task Scheduler for the above script and set it to run as per your requirement.
  • Make sure you periodically check the backup folder size as this script will not delete those for you.
  • Make sure you provide a valid From/To address and SMTP server IP address, validate these settings by checking with your Exchange Administrator if needed.
  • As I have mentioned before the script is very powerful, you can change the task to whatever you like to automate and get an email for failure or success for that particular task.

UserName showing up as DomainName\UserName instead of Full Name in SharePoint 2010

I have seen a lot of people facing a problem in SharePoint 2010, where the UserName is displayed as DomainName\UserName instead of its Full Name. As a solution a lot of people are suggesting to setup the User Profile Synchronization service, but there are organizations who would not like to use it just to fix this issue.

The above image shows that my UserName which was supposed to be displayed as Mukesh Parmar is shown as SharkHeads\Mukesh. This is not right & I would like it to be displayed correctly and without installing and configuring User Profile Synchronization Service.

Let’s Start

The fact is you really do not need to setup User Profile Synchronization service, just to show the user’s display name right. We can utilize the existing SharePoint 2010 CMDLet Set-SPUser to set the User Properties in SharePoint or force a Manual User Profile Update from AD [Active Directory].

To change the Display Name we will be using the Set-SPUser CMDLet with the following switches.

Set-SPUser -Identity ‘SharkHeads\Mukesh’ -DisplayName ‘Mukesh Parmar’ –Web http://SharePointServer

Or [To force a manual sync for the user properties from AD]

Set-SPUser -Identity ‘SharkHeads\Mukesh’ –Web http://SharePointServer –SyncFromAD .

Change the above user details as per your environment. Once the command is successfully executed, the changes should now reflect on the site as seen below.

You might be thinking, by using the above CMDLet, I can only change one user DisplayName at a time, I have around 100’s of users having the Displayname in the following format DomainName\UserName. How do I fix those?

No need to panic you can use the following to do the same.

Get-SPUser –Web http://SharePointServer | Set-SPUser –SyncFromAD

The above will fix all users display name in that particular Web Application.


Below are few point to consider:-

  • When using –SyncFromAD switch, make sure that the Display Name field is set correctly in User Properties of Active Directory.
  • This is not an ideal solution if you are frequently adding new users and changing the user properties in AD. Tho you can schedule the above in Task Scheduler as per your requirement.
  • The above will not fix the Display Name for all Web Application in your farm, you will need to run the above command separately for all sites or create a script for the same or you can setup the User Profile Synchronization Service.
  • For a full list of switches for the Set-SPUser CMDLet you can check the following link.