About UserNotFoundException when SharePoint AD LDS (LDIF) sync operation

You are trying to Configure profile synchronization using a Lightweight Directory Interchange Format (LDIF) file in SharePoint 2013 Using the following article : http://technet.microsoft.com/en-us/library/ff959234.aspx. You have successfully used this method in your SharePoint 2010 farm, however when you try to configure it in SharePoint 2013 and attempt a synchronization, you an ma-extension-error.

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.AggregateException: One or more errors occurred. —> Microsoft.Office.Server.UserProfiles.UserNotFoundException: A user with the specified SID could not be found in the domain.  Check the spelling of the account name ‘johnd@contoso.com’ and try again. —> System.ComponentModel.Win32Exception: No mapping between account names and security IDs was done
at Microsoft.Office.Server.Utilities.Win32.AdvApi.LookupAccountName(String lpSystemName, String lpAccountName, IntPtr Sid, Int32& cbSid, StringBuilder ReferencedDomainName, Int32& cchReferencedDomainName, SID_NAME_USE& peUse)

Reason for this error

The objectSid attribute was not included in the LDIF file.  The objectSid is required in SharePoint 2013 to process the accounts listed in the LDIF file.

For resolution :

1. Go to the LDIF MA, right click and select properties
2. Select Configure Attributes
3. Select New
a. Name: objectSid
b. Type: Binary
c. Select Ok
4. Go to the LDIF MA, right click and select properties
5. Now Select “Define Object Type”
6. From the Object types: select user and click Edit
7. Select objectSid and put it into the May have attributes:
8. Select OK
9. Select Configure Attribute Flow
10. Expand the user object
11. From the Data source attribute, select objectSid
12. From the Metaverse attribute, select objectSid
13. Mapping Type is Direct
14. Flow Direction is Import
15. Select New
16. objectSid displays in the Configure Attribute Flow
17. Select OK
18. Right click the MOSS MA and select properties
19. Select Configure Attribute Flow
20. Verify that the SID to objectSid attribute flow exists
21. Select OK
22. Open your LDIF file for edit
23. Add the objectSid to your accounts
24. Save the file
25. Run a Full Sync

An example from my test LDIF file

dn: CN=John Doe,CN=Roles,CN=Partition,DC=Contoso,DC=COM
changetype: add
displayName: John Doe
userPrincipalName: johnd@contoso.com
sn: Doe
mail: johnd@contoso.com
givenName: John
objectClass: user
objectSid:: AQUAABTfkXMrX0BU0ChCzd4FhEeWw8XrYl1T+Q==

-How you find the correct sid ? You need to extract correct sid from AD LDS.
ldifde -f “c:\import.ldif” -s “localhost:389″ -d “CN=partition,dc=contoso,dc=com” -r “(objectClass=user)” -l “dn,changetype,displayName,userPrincipalName,mail,givenName,sn,objectSid

Quick Performance tip for CQWP

A quick tip for getting your Content Query Web Part results more quickly.Using ID attribute instead of using name attribute for FieldRef element.

A Good sample code for Performace

<FieldRef ID="{ead7c4fb-4ae3-3496-b4bc-b77af4396a71}"></FieldRef> 
<Value Type="Text"> for good performace 

  A bad sample code for Performace

         <FieldRef Name="Title" />
             <Value Type="Text">it takes more time </Value>

Unable to create system performance counter with error code PDH_CSTATUS_NO_MACHINE

One of our case we faced with annoying ULS log errors about performace counters. Multiple errors like below filling ULS logs and keep inflated rapidly.

Unable to create system performance counter ComputerName\Memory\Available Mbytes\. The following exception was thrown: System.ComponentModel.Win32Exception: Unknown error (0x800007d0) at Microsoft.SharePoint.Win32.SPPdh.CheckReturnValue(PDH_STATUS status, Boolean throwOnError) at Microsoft.SharePoint.Utilities.SPPerformanceCounter.Initialize() at Microsoft.SharePoint.Utilities.SPPerformanceCounter.NextValue(Int32 retry, Int32 retryInterval) at Microsoft.SharePoint.Utilities.SPPerformanceCounterMonitorInternal.UpdateValue() at Microsoft.SharePoint.Utilities.SPPerformanceCounterMonitorInternal.Create(String computer, String category, String counter, String instance)
Performance Counter OS (pdh) call failed with error code PDH_CSTATUS_NO_MACHINE.

Microsoft Sharepoint Timer Service’s account does not have the necessary permissions to access the performance counters on the server.

Find Microsoft Sharepoint Timer Service account and set the account as local admin on all machines in farm.

SharePoint 2010 Server with FILESTREAM RBS Provider

What is RBS ?

Remote Blob Storage is a library API set that is incorporated as an add-on feature pack for Microsoft SQL Server. It can be run on the local server running Microsoft SQL Server 2008 R2, SQL Server 2008,SQL server 2008 express or SQL Server 2008 R2 Express. To run RBS on a remote server, you must be running SQL Server 2008 R2 Enterprise edition. RBS is not supported for Microsoft SQL Server 2005.

What is the benefits of RBS ?

RBS can provide the following benefits:

  • BLOB data can be stored on less expensive storage devices that are configured to handle simple storage.
  • The administration of the BLOB storage is controlled by a system that is designed specifically to work with BLOB data.
  • Database server resources are freed for database operations.

When we consider to use RBS ?

  • The BLOB data files are larger than 256 kilobytes (KB).
  • The BLOB data files are at least 80 KB and the database server is a performance bottleneck. In this case, RBS reduces the both the I/O and processing load on the database server.

What is the difference of RBS with FILESTREAM and RBS without FILESTREAM feature ?

This implementation of the FILESTREAM provider is known as the local FILESTREAM provider. You can conserve resources by using the local RBS FILESTREAM provider to place the extracted BLOB data on a different (cheaper) local disk such as RAID 5 instead of RAID 10. You cannot use RBS with the local FILESTREAM provider on remote storage devices, such as network attached storage (NAS). The FILESTREAM provider is supported when it is used on local hard disk drives only.

A remote RBS FILESTREAM provider that is available in SQL Server 2008 R2 Express can store BLOB data on remote commodity storage such as direct-attached storage (DAS) or NAS. However, SharePoint Server 2010 does not currently support the remote RBS FILESTREAM provider.

BLOBs can be kept on commodity storage such as direct-attached storage (DAS) or network attached storage (NAS), as supported by the provider. The FILESTREAM provider is supported by SharePoint Server 2010 when it is used on local hard disk drives only. You cannot use RBS with FILESTREAM on remote storage devices, such as NAS.

The following table summarizes FILESTREAM benefits and limitations.

Operational requirement RBS with FILESTREAM RBS without FILESTREAM
SQL Server integrated backup and recovery of the BLOB Store Yes Yes
Scripted migration to BLOBs Yes Yes
Supports mirroring No No
Log shipping Yes Yes, with provider implementation
Database snapshots No1 No1
Geo replication Yes No
Encryption NTFS only No
Network Attached Storage (NAS) Not supported by SharePoint 2010 Products Yes, with provider implementation

1If the RBS provider that you are using does not support snapshots, you cannot use snapshots for content deployment or backup. For example, the SQL FILESTREAM provider does not support snapshots.

If FILESTREAM is not a practical provider for your environment, you can purchase a supported third-party provider. In this case, you should evaluate the following criteria when shopping for a provider:

  • Backup and restore capability
  • Tested disaster recovery
  • Deployment and data migration
  • Performance impact
  • Long-term administrative costs

What is the Prerequistes ?

If you plan to store BLOB data in an RBS store that differs from your SharePoint Server 2010 content databases, you must run SQL Server 2008 with SP1 and Cumulative Update 2. This is true for all RBS providers.

Important Notes

  • RBS does not enable any kind of direct access to any files that are stored in Microsoft SharePoint 2010 Products. All access must occur by using SharePoint 2010 Products only.
  • If you are storing many small (less than 256 KB) files that are frequently accessed by many users, you might experience increased latency on sites that have many small files that are stored in RBS. Increased latency is one cost factor that you should consider when you evaluate RBS for your storage solution. However, it is unlikely to be the strongest consideration. The amount of increased latency is also related to the RBS provider that you use.
  • RBS can be run on the local server running Microsoft SQL Server 2008 R2, SQL Server 2008 or SQL Server 2008 R2 Express. To run RBS on a remote server, you must be running SQL Server 2008 R2 Enterprise edition. SharePoint Server 2010 requires you to use the version of RBS that is included with the SQL Server Remote BLOB Store installation package from the Feature Pack for Microsoft SQL Server 2008 R2. Earlier versions of RBS will not work with SharePoint Server 2010. In addition, RBS is not supported in SQL Server 2005.
  • For best performance, simplified troubleshooting, and as a general best practice, we recommend that you create the BLOB store on a volume that does not contain the operating system, paging files, database data, log files, or the tempdb file
  • Microsoft SQL Server 2008 R2 Express supports databases up to 10 GB. If the installation includes content databases that are larger than 4 GB but smaller than 10 GB, you can upgrade to SQL Server 2008 R2 Express for your content database storage solution instead of implementing RBS. For more information, see Microsoft SQL Server 2008 R2 Express Edition
  • WARNING:We do not recommend that you install RBS by running the RBS_X64.msi file and launching the Install SQL Remote BLOB Storage wizard. The wizard configures the RBS Maintainer to run a scheduled task every 30 days. This setting might not be optimal for your environment. For more information about the RBS Maintainer, see the SQL Server Help documentation that is included with the SQL Server Remote BLOB Store installation package from the Feature Pack for Microsoft SQL Server 2008 R2. (ref : Install and configure Remote BLOB Storage (RBS) with the FILESTREAM provider (SharePoint Server 2010))UPDATE 18.04.2011: With new version RBS.msi you can use GUI interface to install rbs to your envoriment.
    You have to select “Show the optional advanced configuration options” when wizard in progress. And uncheck the maintaner  schedule configuration for disable maintainer.You can download from Microsoft SQL Server 2008 R2 Feature Pack Page
    This is the only provider that Sharepoint Server 2010  with version 10.50.xxxx (R2) .But you can load this provider to SQL Server 2008 express loaded machine.

Tips and Tricks

  • You can allow only big files to be put into FILESTREAM. Since FILESTREAM performance is not as good as the databases when it deals with small files (for example, <1M), you can change this threshold.  The following Windows PowerShell command change the setting to 1M (1048576 bytes), file below 1M will be stored in DB.

$cbd = Get-SPContentDatabase “WSS_Content”

It would be good to test the performance based on your own storage and hardware.

This Article base on below MSDN articles :

And Blog Articles

Other Resources

Happy Codding…