Sharing the experience search

Search sharing-the-experience.blogspot.com

Thursday, October 20, 2011

SimpleConcept: Message Error: 18456, Severity: 14, State: 38.


[Question]:
Message:
Message Error: 18456, Severity: 14, State: 38.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>]
How to figure out what application to what database is trying to connect?

[Answer]:
State 38: Initial database could not be determined for session (SQL 2008)
The best way to investigate and locate the problem is SQL Server Profiler.
Run the trace with following trace properties:


And the filter:

You will see the ApplicationName from the request is originated.


Tuesday, October 18, 2011

"SharePoint 2007 to 2010 Upgrade" online project (part 6) : Database attach upgrade. BDC to BCS conversion

[What you have]:
 A new 2010 SharePoint farm. Your upgrade strategy is "database attach".

[What you want]:
You want to install your old BDC files on the farm. And probably, you already know that
BDC ADF files should be converted first in order to work on the new 2010 farm. So, probably you are looking for the easiest way to convert them.

[What you want to know]: 

 In case of "in-place upgrade" Business Data Catalog adf files will be converted automatically. How Business Connectivity Services upgrade works (in-place upgrade). Make a note that a backward-compatible Application Registry Service doesn't have UI interface to manage it.


In case of "database attach" upgrade strategy, you may have read that you can attach SSP database to migrate its content. Truth is: When you attach an SSP database, only your user profile store is upgraded. Search settings, Excel Service settings, Business Data Catalog (BDC) application definitions, and other settings must be recreated from scratch. Upgrading by using database attach (BDC)


You may have even discovered a lengthy MDSN article (How to: Manually Upgrade Business Data Catalog Application Definitions to Business Data Connectivity Models)that follow you through the whole experience with manually editing ADF file to convert it into a BDC Model.  (BTW, still confused with BDC and BCS? - SharePoint 2010: BCS and BDC (Naming convention))


[What you want to do]:
My suggestion to you -
" hybrid BDC upgrade approach".  It's quite simple and probably you have already figured out). 
The idea is to:
1. run "in-place upgrade" on some test 2007 farm with BDC files already installed there;
2. Export BDC Models from the upgraded farm.
3. Import them into a new fresh 2010 farm.



 I see the most common scenario for  "BDC Conversion into Models"  as:
1. "Hybrid BDC upgrade approach"
2. Exporting the upgraded BDC models through SharePoint designer (SPD) 2010.
3. Creating a "Business Data Connectivity Model" project 
4. Deploying a declarative BDC model with  a feature in the new SharePoint 2010 farm.



Regarding details, refer to the material below.

[What you want to consider]:

My fresh experience with BDC upgrade is telling me that you can easily bump into some new errors that you haven't seen before since you have just started using SharePoint 2010.
My recommendation is to follow me. I am planing to get deeper with the BDC conversion and I will share my experience with you.


And some quick notes:


When to Use SharePoint Designer vs. Visual Studio When Building Solutions Using BCS


BDC MetaMan works with .Net connectivity , it won't help with declarative Business Data Catalogs.


The new project template "Business Data Connectivity Model" in Visual Studio 2010  will help you to package and deliver converted BDC. BUT, BDC Model designer in Visual Studio doesn't work with declarative BDC models, only .Net LobSystem,



You can import a model into the Project that was created by using other tools such as SharePoint Designer. You might choose to import an existing model to your project in the following situations:


To customize a model that is already deployed to a SharePoint server farm.


To package and deploy an existing model to multiple SharePoint server farms.


In this scenario this article is a great help - Deploying A Declarative BDC Model with a feature.



Friday, October 14, 2011

Simple concept: Set permissions for all users to BDC

[Question]: How to set permissions for all users on BDC file?
[Answer]: NT AUTHORITY\Authenticated Users
In case you want to automate the process here are 3  options: BDCM: How to set permissions through the code?

Simple concept: After In-place upgrade stsadm.exe crashed

[Question]: why stsadm.exe gives an error after in-place SharePoint 2010 upgrade?
Unhandled Exception: System.MissingMethodException: Method not found: 


[Answer]: You have an old path for stsadm in the environment variables. Change it to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN\

Simple concept: Managed Paths: Wildcard or Explicit?

[Question]: What it is Managed Paths? What the difference between Wildcard and Explicit?
[Answer]:
   Managed paths allow SharePoint to determine what portion of a given URL corresponds to the site collection URL
  Explicit managed paths allow a single site collection at the path Url
 Wildcard  - allow unlimited site collections to be created under the path Url.

Friday, August 19, 2011

stsadm -o enumallwebs -includefeature: Command line error. Invalid parameter

[What you have]:
stsadm -o enumallwebs  -includefeatures gives an error: "Command line error. Invalid parameter"

[What you want]:
You want to run command similar to this
stsadm -o enumallwebs  -includefeatures -includesetupfiles -includewebparts -includeeventreceivers -includecustomlistview > enumallwebs.xml

[What you want to know]:
Description of the SharePoint Server 2007 Cumulative Update Server Hotfix Package (MOSS server-package): October 27, 2009 . Version 12.0.0.6520. includes new signature for stsadm -o enumallwebs


stsadm.exe -o enumallwebs
           [ -databasename <database name>]
           [ -databaseserver <database server name>]
           [ -includefeatures ]
           [ -includesetupfiles ]
           [ -includewebparts ]
           [ -includeeventreceivers ]
           [ -includecustomlistview ]

Using this method with additional parameters does a wonder. It shows features, setupfiles  and eventrecievers that are currently installed on the site (spweb)
It's very helpful if you are planing to migrate to 2010. The main  key of successful upgrade is to know the environment prior to it.

[What you want to do]:
To find out what's the current version of SharePoint  refer to Where to look for SharePoint version?

Thursday, August 11, 2011

SharePoint 2010: PowerShell and Stsadm

[What you have]:
SharePoint 2010 or SharePoint 2007 and desire to start using PowerShell

[What you want]:
You want to understand why you better off  STSADM? And you want small guidelines with PowerShell.

[What you want to know]:

 "STSADM has been officially deprecated by Microsoft and may not appear in the future version of SharePoint (after 2010). So it's a good idea to start reducing or eliminating your dependency on STSADM"
 (Automating SharePoint 2010 with Windows PowerShell 2.0)

The reason I have shifted to PowerShell one year ago while still working with  SharePoint 2007 was an emergency. We systematically abused SharePoint 2007 by changing schema of already existed list. At the some point on Prod we had the biggest list broken. The only way to fix it without restoring backup and keeping the desired schema changes is to use PowerShell! I have fixed the list in an hour on live Prod and reapplied changes directly on the list through SharePoint API. All of this was done in one tiny Powershell window. Feel grateful and felt in love with PowerShell forever...

What is PowerShell anyway? It's a scripting language.  And also it's an environment where the script is executing. It's quite easy to write a powerful command with some additional looping and filtering. You can build the same logic as using C#. In fact, PowerShell's capabilities are fully featured and mirror the capabilities of C# language, with only slight differences in syntax.

The source of well-known and stable scripts for 2007 SharePoint:
PowerShell:
http://sharepointpsscripts.codeplex.com/
STSADM:
http://blog.falchionconsulting.com/index.php/downloads/

Here is a great resource to borrow a PowerShell script for a particular need: http://gallery.technet.microsoft.com/scriptcenter .

Index of SharePoint Server 2010 Windows PowerShell cmdlets

Stsadm to Windows PowerShell mapping (SharePoint Server 2010)

SharePoint 2010 is shipped with PowerShell 2.0.In SharePoint 2010 PSSnapin (Microsoft.SharePoint.PowerShell) there are more than 530 cmdlets ("command-lets"). The great news is you don't need to learn all of them. Start easy.

Here are  few small hints for easy-going start:

  • Get-Help. The best way to learn PowerShell is to use help command.
  • Get-SP<noun> | Get-member . Make a habit to observe available methods and properties first. It help to write more appropriate script
  • -Whatif . Use the risk mitigation parameters. 
Get-Process  | Stop-Process -whatif. The command produces the following example - what would be performed if I executed the command without the -whatif parameter.
  • Set-ExecutionPolicy AllSigned. The AllSigned execution policy is best for production since it forces the requirement for digital signatures on all scripts and configuration files.  (Signing PowerShell Scripts)
  • To prevent memory leak while working with such objects as SPSite, SPWeb, SPSiteAdministration - become familiar with Start-SPAssignment and Stop-SPAssignment. By default PowerShell runs every command in the new thread. Consider for COM objects (such as SPSite, SPweb, SPSiteAdministration) set $Host.Runspace.ThreadOptions ="ReuseThread" (refer for an example to sharepoint.ps1)). Start-SPAssignment and Stop-Assegnment will not work correctly unlesss Reuse Thread is specified.
  • Refer to Stsadm to Windows PowerShell mapping for easy PowerShell adoption
  • In order to run script file (*.ps1) you need to change the default value of Execution Policy OR Sign the script. The best recommendation is not lower the restriction further than "RemoteSigned". But be aware  that ExecutionPolicy is not a security feature. It can be easily overcame.
Best practices:
 On prod create a custom profile $profile.AllUsersAllHosts where specify  :
- $ConfirmPreference="Low"  PowerShell will automatically question all actions to confirm;
- Start-Transcript. It will record all Powershell activity 



P.S. SharePoint 2010 Management Shell is a just a PowerShell instance that loads sharepoint.ps1 script. So, you are free to use your own favorite IDE to build scripts, just load sharepoint.ps1 (Simple concept: How to use SharePoint cmdlets in PowerShell ISE)

[What you want to do]:
Are you brand new to PowerShell? To start easy and fast,  go to PowerShell and SharePoint: What, Why and How
Here is series of PowerShell introduction PowerShell Week: Learn It Now Before It's an Emergency