Saturday, October 3, 2015

Databases Running in Compatibility Range, Upgraded Recommended

If you are running SharePoint 2013 and SharePoint Health Analyzer has thrown "Database Running in Compatibility Range, Upgraded Recommended" issue then below is the fix to get rid of this issue.

The reasons of issuing this error are probably you have migrated SharePoint Server from SharePoint 2010 to SharePoint 2013 or you have installed March 2013 SharePoint Uber Update.
In either case this issue is being thrown by SharePoint Health Analyzer.

1. Run SharePoint 2013 Management Shell (Obviously Run As Administrator)

2. Paste the command "PSConfig.exe -cmd upgrade -inplace b2b -force -cmd applicationcontent 
-install -cmd installfeatures" and press enter.

3. This will take few minutes to complete.

4. Go to Error and Reanalyze. This will resolve the issue. However, you may this may complain the ContentDB upgrade issue which you can resolve by using "Upgrade-SPContentDatabase" and then enter the name of the ContentDatabase.









Bulk User Profile Deletion in SharePoint 2010 / 2013

Sometimes we are not sure about which AD objects to be imported from Active Directory to SharePoint and later when we come to know AD objects we need to delete existing imported profiles and re run the full synchronization.
In order to delete existing profiles below Power shell script will help us to delete all profiles except Farm Account from SharePoint User Profile.

PowerShell Script - Delete All User Profiles - SharePoint 2010 / SharePoint 2013
#The scripts is distributet "as-is." Use it on your own risk. The author give no warranties, guarantees or conditions.
#Add SharePoint PowerShell SnapIn if not already added

 if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null)
{
  Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}

#Set my site host location. In this example I use host location on the same web application as the portal itself.
#MS recommends to use different web application for hosting your personal sites
#In this example My Site Host is on location http://sp2010/my/mysite/

$site = new-object Microsoft.SharePoint.SPSite("sp2010/my/mysite/");
$ServiceContext = [Microsoft.SharePoint.SPServiceContext]::GetContext($site);

#Get UserProfileManager from the My Site Host Site context

$ProfileManager=new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServiceContext)
$AllProfiles = $ProfileManager.GetEnumerator()
foreach($profile in $AllProfiles)
{
$DisplayName = $profile.DisplayName
$AccountName=   $profile[[Microsoft.Office.Server.UserProfiles.PropertyConstants]::AccountName].Value

#Do not delete setup (admin) account from user profiles. In this case account is Domain\XYZ

 if($AccountName -ne " Domain\XYZ ")
{
$ProfileManager.RemoveUserProfile($AccountName);
write-host "Profile for account ", $AccountName, " has been removed"
}
}
write-host "Finished."

$site.Dispose()

Monday, August 3, 2015

Register-SPWorkflowService : The Underlying connections was closed: An unexpected error occured.



This issue occurs when we run power shell command to register workflow manager service after successfully installing and configuring Workflow Manager in SharePoint 2013.










The primary reason of getting this error is incorrect Power Shell command format. Make sure if your workflow manager service is configured on https then use https in workflow manager site url and also make sure to mention domainname.com in your workflow manager site url to make Power Shell work properly.
In the above command I have not used https in my –workflowHostUri and also I have not associated domain name in my –workflowHostUri parameter.
Now, I have rectified this after changing the Power Shell command and it worked for me.

  












So, the correct Power Shell command should be as under:

Register-SPWorkflowService –SPSite "http://SPSERVER2012" –WorkflowHostUri "https://SPSERVER2012.SPDOMAIN.com:12290/" –AllowOAuthHttp

Once this command executes successfully. You can access SharePoint Designer 2013 and under workflows options you will have SharePoint 2013 Workflow option available to make Workflows for SharePoint 2013.
















Hope this will work for you folks.

Wednesday, July 29, 2015

0x80070003 error on Restore-SPSite when restoring a SharePoint 2013



The below error comes because of two main reasons.










  1.  When SharePoint versions are different from the source of the back to restore server.
  2.  Another reason is due to Content Database not updated.

When you have different versions you need to make sure that you have same version else if you have latest version of SharePoint running and your back is of older version make sure to upgrade the database and then restore the site collection using PowerShell.

First run the Upgrade-SPContentDatabase WSS_Content.  

Take the site collection backup and then restore. 

This will hopefully help you get rid of InvalidData error in Restoration of Site Collection.






Monday, July 27, 2015

Common issues and their resolution while installing SharePoint 2013 Server





Most of the times we face certain issues in installing SharePoint 2013 Server on Windows 2008 R2 or on Windows Server 2012.

I have described below issues with their solutions which I have faced every time I install SP 2013. 

1. Enabling .Net 3.5 on Windows Server 2012: Since Windows Server 2012 already has .Net framework 4.5 installed so we need below command to be executed in Command Prompt (Run as Administrator) after mounting Windows Server 2012 installation disk to enable .Net 3.5.
 Dism /online /enable-feature /featurename:NetFX3 /All    /Source:D:\sources\SxS                    /LimitAccess (Where D: is the location where Windows Server 2012 is mounted). 

2. SharePoint 2013: The tool was unable to install Application Server Role, Web Server (IIS) Role: This issue occurs due to the fact that the installer is locating the installer is trying to run the executable C:\Windows\System32\ServerManagerCMD.exe – which is not there in System32 directory. However, you will find ServerManager.exe, just copy this .exe file and paste. Then, rename SystemManager.exe to SystemManagerCMD.exe and try to run the PrerequisiteInstaller.exe. 

3. Installing AppFabric Cache for SharePoint 2013: In order to install Windows AppFabric Cache try to use Command Prompt (Run As Administrator) and execute below command instead of executing AppFabric Cache manually. Copy the Windows AppFabric Cache file in Prerequisite Installer Folder in SharePoint 2013 Installation Folder.
 
 

Then on Command Prompt access that location and then run the below command:  

prerequisiteinstaller.exe /AppFabric:WindowsServerAppFabricSetup_x64.exe