Powershell tricks - BCS - List External content types (LOB Systems)
I spent a few hours figuring this out, hope it's useful for someone:)
From Powershell list the external content types (ECTS) / LOB (Line of Business) from the BCS/BDC (catalog meta data) service.
This is useful if you're scripting e.g. like we are adding of content-sources using the BDC models created. Here it is:
$ctx = "http://localhost"
# Get the BDC context
$bdc = Get-SPBusinessDataCatalogMetaDataObject -BdcObjectType Catalog -ServiceContext $ctx
# Get the list of all LOB systems
$lobs = $bdc.GetLobSystems("*")
Foreach($lob in $lobs){
$lobId = $lob.Id
$lobName = $lob.Name
$lobDisplayName = $lob.DefaultDisplayName
$lobEntities = $lob.Entities
$lobSystemInstance = $lob.SystemInstances
Write-Host $lob.DefaultDisplayName
}
External Content Types - BDC
We've created an ECT (External Content Type) for our Fast Search Crawler to process. This worked all well. After playing around with it and doing various refactoring, when used in an external list, sharepoint throws the following error:
"Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator. Correlation ID: e5f9698d-23e3-4926-9fdd-63f17073f3ec."
After spending a couple of hours trying to figure out what went wrong (Cause no logging showed anything useful), it turns out that the ECT field and properties is still stuck for the old version. I tried deleting the old versions before redeploying. No luck, the old fields where still there.
Finally, we figured out what to do: It looks like the ECT is stuck in the Application Service Proxy aswell, and when redeployed / removed, this is not updated. Solution: Log in to Central Admin - Goto BDC application proxy, remove the ECTS and redeploy !:D Voila! You would have to recreate the external lists though. But it works.
Sharepoint 2010 - Powershell commands
Ever tried to run powershell command on the server with another user (not the one sharepoint was installed with)?
You might recognize an error like "The local farm is not accessible. Cmdlets with FeatureDependecy are not registered".
Luckily, it's fairly easy to solve this problem (Please don't do this on a production server, or minimize the access needed);
- Log onto your sql-server
- Goto security
- Add the user you're having trouble with
- Under "user mapping" ; select the Sharpoint_Config
- Add the Roles: db_owner and Sharepoint_Shell_Access
- Press OK.
- Re-open Powershell using the troublesome user and it should work!
Sharepoint 2010 - Solution deployment
OK.
Here's the first version of the solution deployer. It consists of a powershell script (that must be run in order to be able to deploy solutions from the web), a webpart for deploying /updating/removing the solutions and some custom code doing all the work.
I created a webpart listing all solutions (with a configurable path / dir to scan for solutions) with the different commands. Forgive me for the GUI, I couldn't care less for the GUI for this utility ;)
Note: When the deploy / Remove is clicked a job is created which will start the deploy / removal job ASAP. This will do a IISReset making the site unavailable for a while.
This code comes with no warranty, nor have the update method been tested extensively. There will be improvements to the code and the webpart will be made more configurable (e.g removing hardcoded paths etc.).
This can easily be automated by making visual studio build the solutions to a remotely shared folder on the server, then the webpart will pick up the WSP-files and the developers can then update them from the interface itself.
The files are attached to this post.
Attachments:
SPCommon.zip (9.1 KB)
Set-RemoteAdministratorAccessDenied-False.zip (575 B.)
Sharepoint 2010 - Mixed Authentication
Our intranet site will have to work for external users from outside the AD. We also like the neat automagical login created by Windows autentication. Wouldn't it be great to combine FBA + WA and automatically select the authentication method by where you are located?
I found this neat little project on CodePlex for this: http://spautomaticsignin.codeplex.com/ . Installation and deployment is fairly easy and the cmdlet provided for the IP mappings is pretty neat! Check it out if you have the same needs for your site.
08/14/10 05:33:43 pm, 

