Category Archives: Blog

Error starting a scheduled SQL 2008R2 Agent Job

When I tried to run the job that was created from a maintenance plan in SQL server 2008 R2, the job failed and gives the following message:

[298] SQLServer Error: 15404, Could not obtain information about Windows NT group/user ‘DOMAIN\SYS_USER_NAME’, error code 0×5. [SQLSTATE 42000] (ConnIsLoginSysAdmin)

I did use Windows Autheniciaton mode and the Sys account that runs the job is set as sysadmin, setadmin, processadmin in the SQL server roles. The SQL agent services is using LOCALSYSTEM to run.

I figured out that the problem occurs because the SQL server is in DOMAIN A and the Sys user is from DOMAIN B. There isn’t a both ways thrust between the two domains, so the DC in DOMAIN B doesn’t allow DOMAIN A to query for the user information.

I solved this issue by running the SQL Agent with a Sys account from DOMAIN B that has “Log on as a service” permissions and the correct SQL permissions instead of the LOCALSYSTEM account.

Access denied: Business Data Connectivity

After creating an External Content Types and connecting the ECT to a list I received the folloing error: Access denied by Business Data Connectivity

Business-Data-Connectivity-1

I created the ECT with SharePoint designer and give the correct users the correct permissions. Somehow when I saved and modified the ECT from SharePoint designer again,  the permissions got lost. I found out that if you modify the ECT in SharePoint designer you need to go back into Central Administration and set permissions again for the Business Data Connectivity Service application.

Follow these steps to give the correct permission on the ECT:

Open the  SharePoint 2010 Central Administration on the server  and click on Manage service applications.

Business-Data-Connectivity-21

Then click on Business Data Connectivity Service:

Business-Data-Connectivity-31

Select the External Content Type and click Set Object Permissions

Business-Data-Connectivity-41

Add the correct users and give them the right permissions:

Business-Data-Connectivity-61

SharePoint 2010 Error (in CoreResultsWebPart::OnInit) when searching

After installing a fresh SharePoint 2010 standard farm I kept on receiving this error when I try to search something in the search center:

CoreResultsWebPart::OnInit: Exception initializing: System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Office.Server.Search.WebControls.CoreResultsWebPart.SetPropertiesOnQueryReader() at Microsoft.Office.Server.Search.WebControls.CoreResultsWebPart.OnInit(EventArgs e)

After trying the following actions:

  • ensuring that hotfix 976462 is installed
  • ensuring that the “SharePoint Server Search” and “Search Query and Site Settings Service” services are running, both are up and running
  • removing and reinstalling the search application
  • ensuring that the application pool is assigned correctly
  • restarting the timer service
  • restarting the search service
  • rebooting

Still no luck, than I figured that the Search webpart wasn’t activated. So activating the site collection Search Webpart solved this issue.

SharePoint PowerShell Backup Script with Windows Scheduler

An easy script to backup your SharePoint farm with Windows scheduler. First create a powershell script:

1-Backup a site:
Add-PSSnapin Microsoft.SharePoint.PowerShell
backup-spsite -identity $args[0] -path $args[1] -force

2-Backup the complete farm:

Add-PSSnapin Microsoft.SharePoint.PowerShell
Backup-SPFarm -Directory $args[1] -BackupMethod full

Next, create a .bat script to start the powershell script:

@echo off
SET SOURCE_SITE=http://sharepointfarm/
SET DEST=E:\SQLBackupFolder\
echo “Backup SharePoint Started at” %DATE% >> E:\SQLBackupFolder\Logs\Log.txt
powershell -command E:\SQLBackupFolder\SPbackupScripts\backupSP.ps1 %SOURCE_SITE% %DEST%
echo “Backup completed successfully at %DEST%” on %DATE% >> E:\SQLBackupFolder\Logs\Log.txt
@echo on

Now you can use the .bat start script in Windows Scheduler to backup your sharepoint farm. In the Task Scheduler, the account needs to be set with admin permissions to run it properly.

To clean up older sharepoint backups, schedule the following powershell script. This script checks the spbrtoc.xml for the number of sharepoint backups.

# Location of spbrtoc.xml
$spbrtocXML = “\\UNC backup folder\spbrtoc.xml”
# 10 Days of backup will be remaining after backup cleanup.
$days = 10
# Import the Sharepoint backup spbrtoc.xml file
[xml]$sharepointlist = gc $spbrtocXML
# Find the number of backups in spbrtoc.xml
$oldbackups = $sharepointlist.SPBackupRestoreHistory.SPHistoryObject |
? { $_.SPStartTime -lt ((get-date).adddays(-$days)) }
# Delete the backups from the Sharepoint backup spbrtoc.xml file
$oldbackups | % { $sharepointlist.SPBackupRestoreHistory.RemoveChild($_) }
# Delete the folders of the old backups on file level
$oldbackups | % { Remove-Item $_.SPBackupDirectory -Recurse }
# Save the changed spbrtoc.xml
$sharepointlist.Save($spbrtocXML)

CustomErrors setting in SharePoint 2010

It’s a little bit different than SharePoint 2007, you need to change two web.config files instead of one:

  • Underneath  [systemdrive]:/inetpub/wwwroot/wss/virtualdirectories/
  • In the layouts directory underneath the SharePoint root directory or 14 hive – [systemdrive]:/Program Files/Common Files/Microsoft Shared/Web Server Extensions/14/TEMPLATE/LAYOUTS/

The settings that you need to change in the web.config file are still the same:

  • Change Debug=”true”
  • CallStack=”true”
  • CustomErrors=”Off”