Tuesday, May 22, 2012

SP2010 Export/Import List

Scenario:
Copy a list "ListName" (Title = ListTitle) from source "Site 1" to destination "Site 2" subsites. "Site 2" already has a list with the name "ListName". The title and url both are the same on source and destination.


Solution:


export-spweb "http://hostheader/subsite/site 1" -path "c:\folder_name" -itemurl "/subsite/site 1/listname" -includeusersecurity -nofilecompression -includeversions 4


Open the folder, "folder_name" and edit the Manifest.xml file.
Find and replace "ListName" to something else.
Find and replace "ListTitle" to something else.


Import-SPWeb " http://hostheader/someothersubsite/site 2 " -path "c:\folder_name" -nofilecompression -includeusersecurity



Monday, May 14, 2012

Powershell - Bulk spdispose check


Script to bulk-rename all wsp's to cab:
dir *.wsp | Rename-Item -NewName {$_.Name.Replace('.wsp','.cab')}


Script to extract dlls from cab files:
get-childitem | foreach-object {Write-Host "Processing:"$_.Name; expand.exe .\$_.Name -f:*.dll "Path where all extracted dlls must be saved. Must end with \ ";  }




Script to perform dispose check and save log file for all dlls:
get-childitem "Path where all dlls are saved" | foreach-object {Write-Host "Processing:"$_.Name; .\spdisposecheck.exe $_.fullname }

Tuesday, May 8, 2012

SP2010 Search one-way trust domain

Scenario:
In a multi-domain environment where is one way trust between domanis search does not return security trimmed results for either one of the domains. 


Error in ULS: 
AuthzInitializeContextFromSid failed with ERROR_ACCESS_DENIED. This error indicates that the account under which this process is executing may not have read access to the tokenGroupsGlobalAndUniversal attribute on the querying user's Active Directory object. Query results which require non-Claims Windows authorization will not be returned to this querying user. da324c89-8a72-4b2b-a2b9-ed5cab78c16d


Solution:
This is because the search service accounts do not have required permissions to gather ACLs for the domain account who issued the search query. Resolution is to force search service app to use Claims to store acl information and for security trimming the service account do not need to talk to domain controllers to get acls.


http://support.microsoft.com/kb/2344518 

SP2010 Upgrade


Scenario:
Error while upgrading site with publishing features enabled. Command used is upgrade-spcontentdatabase


Upgrade [SPSite Url=site url] failed. Microsoft.SharePoint.Portal.Upgrade.MossSiteSequence has the ContinueOnFailiure bit set. Moving on to the next object in sequence.
[powershell] [SPUpgradeSession] [ERROR] [5/8/2012 2:16:28 PM]: Inner Exception: Attempted to perform an unauthorized operation.
[powershell] [SPUpgradeSession] [ERROR] [5/8/2012 2:16:28 PM]:    at Microsoft.SharePoint.SPSite.set_AllowMasterPageEditing(Boolean value)
   at Microsoft.SharePoint.Portal.Upgrade.AllowMasterPageEditingAction.Upgrade(SPSite site)
   at Microsoft.Office.Server.Upgrade.SiteAction.Upgrade()
   at Microsoft.SharePoint.Upgrade.SPActionSequence.Upgrade()


Solution:
Make sure all options are enabled for the SharePoint Designer settings at the web application level and re-run the command.

Friday, May 4, 2012

Managed Metadata Service - OfflineTermStorenames

Scenario:
Created a new managed metadata service application and associated it to web apps. When we try to execute the below three lines of powershell, you notice that the metadata service application is listed under offlinetermstorenames and nothing under TermStore or DefaultTermStores. This used to be case even if I created the service application using UI or Powershell.



$site = Get-SPSite $site_url
$session = Get-SPTaxonomySession -site $site
$session



Solution: 


To get offline termstore back:
1. Make sure we have MMS service started on at least one machine in the farm.
2. IIS reset on all WFEs.
3. Wait for about 15 to 20 minutes. [IMP Step]
4. It will back online by itself.



Reference:
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.taxonomy.taxonomysession.offlinetermstorenames.aspx

Wednesday, May 2, 2012

Search service is not able to connect to the machine that hosts the administration component

Scenario:
A SP2010 Farm with 1 SSA(Search service application). Trying to provision another SSA using UI or Powershell, either ways results in the same behavior. The provisioning completes successfully however when you navigate to the SSA management page for the particular app, it displays the above message with the GUID of the administration component. Key point to observe here is that the search pool account used by SSA1 is the account under which the OSearchv4 service runs. SSA2 which is being provisioned now uses a different service account.


Solution:
I checked the databases that got created once SSA2 was provisioned and noticed that only the new service account is getting added to them as owner. ULS logs in verbose mode indicates that the OSearchV4 service account is trying to access SSA2's databases and cannot login. Hence the solution to my problem was to simply add the OSearchv4 service account as dbowner to the newly created databases and then wait for some time for the administration component to get provisioned.


Alternatively the below powerhshell can also be executed,
$searchapp=New-SPEnterpriseSearchServiceApplication "SSA2 name"

$searchinstance= Get-SPEnterpriseSearchServiceInstance "servername" 
$searchadmin=Get-SPEnterpriseSearchAdministrationComponent -SearchApplication $searchapp
$searchadmin=Set-SPEnterpriseSearchAdministrationComponent -SearchApplication $searchapp -SearchServiceInstance $searchinstance


Remember to wait at least 5 mins for the provisioning to complete.