Advertisements

Creating New Service Application Proxy Groups and Associating Services and Sites

Sometimes the need arises to create separate Service Application Proxy groups in SharePoint. Starting with SharePoint 2010, you’ve been able to do this. In SharePoint 2007, you would have created different Shared Service Providers. Your needs might be, that you are exposing web applications to a different group of users, and need separate applications such as Search and the User Profile Service. This also allows you to run those service applications under different accounts, if you needed to for security reasons.

First, let’s create the proxy group we want to use. And lets give it a name.. in the example, I’ll be using "Redacted"… because all my screenshots have had the real service application group identity redacted 🙂 But you can name this anything you’d like. Load up the SharePoint Version Management Console… and call the New-SPServiceApplicationProxyGroup PowerShell cmdlet.

New-SPServiceApplicationProxyGroup "Redacted"

Once you have your new Service Application Proxy Group created, you can then change the web application subscriptions to the proxy groups. To do so, go into Central Administration > Application Management > Web Applications > Manage web applications and select one of your sites. In the ribbon, then select Service Connections under the Management group.

Image(5)

You can always verify this by then going into Central Administration > Application Management > Service Applications > Configure service application associations

Image(6)

Select the Web Applications view, and then you should see your sites, and their associated applications with their Application Proxy Groups.

Image(7)

When you create a new service application, by default, it is going to get tossed into the default group. There is no way in the UI presently to allow you to change associations in the UI once you have created your new proxy group, so, what you need to do is to handle this in PowerShell. The best way to get the IDs for your service applications is to use Get-SPServiceApplication, and then only display the two columns you need, DisplayName (so you know what ones you are looking for), and the Id.

Get-SPServiceApplication | select-object DisplayName,Id

Image(8)

Once you have the ID’s that you need for your Service Applications, you now need to add them as members to the new proxy group you created earlier. You can do this by using the Add-SPServiceApplicationProxyGroupMember PowerShell cmdlet, like so:

Add-SPServiceApplicationProxyGroupMember "Redacted" -Member "f166672c-24b5-4f1a-bd2d-e8436d966abb"

This will add the "Secure Store Service – Redacted" Service Application to my new proxy group Redacted.

If for some reason, one of the service applications do not want to move out of the default group after adding them into the new group, you can remove them with the Remove-SPServiceApplicationProxyGroupMember PowerShell cmdlet. Just an FYI – the default group is referenced as "", so, if you needed to now remove the above service from the default group, you will need to address it as:

Remove-SPServiceApplicationProxyGroupMember "" -Member "f166672c-24b5-4f1a-bd2d-e8436d966abb"

Advertisements

SharePoint Patterns and Practices Cmdlet Reference Guide Now Available

Finally here! Microsoft has released a reference guide for the over 200 Patterns and Practices Cmdlets!

ScreenClip

Check it out here: http://aka.ms/sppnp-powershell

Speaking at SPTechCon San Francisco in March 2013

imageI have the privilege to announce that I will be presenting again in lovely San Francisco at The SharePoint Technology Conference on March 3-6th, 2013.

Information on the event and the sessions I will be presenting is below. I hope to see you there! San Francisco is a beautiful place, and I cannot wait to get back down (and over… diagonally really) there.

 

Event Description

SPTechCon: The SharePoint Technology Conference – is the largest independent SharePoint conference in the world – for IT professionals, business managers, analysts, and developers. Choose from more than 90 Classes and Workshops!!! Learn from the brightest minds in the SharePoint universe – more than 40 Expert Speakers and Microsoft MVPs! There’s a shortage of SharePoint experts! Develop your skills, and improve your own professional standing! "I would recommend SPTechCon to SharePoint admins and developers. By far the best Tech Event I have attended." Venki Oruganti , Software Developer – Pitney Bowes

 

Planning and Configuring Extranets in SharePoint 2010

Monday, March 4 – 11:15 AM – 12:30 PM

Most companies, large or small, require contact and collaboration with external entities, whether they are vendors, clients, or contractors. SharePoint gives us the ability to open up portals for collaboration with these external entities, and this session will show you how to accomplish this using SharePoint 2010.
We will review what is required to make SharePoint “open” to the external world and discuss scenarios regarding security and privacy. We will also walk through configuring Forms-Based Authentication, Claims-Based Authentication, as well as using Business Connectivity Services in SharePoint 2010 to authenticate and manage our external users. Once completing this session, you should have a firm grasp on how to configure an extranet environment using SharePoint 2010, as well as what should be considered during the planning of your extranet scenarios.

Level: Advanced
Topic Area: IT Pro Essentials

Automating Your Enterprise Application Deployments With PowerShell

Tuesday, March 5 – 4:00 PM – 5:15 PM

In enterprise application deployments to SharePoint, there are generally farms or Web applications that host specific applications for specific groups, rather than having just an all-in-one deployment. Oftentimes, you do not have access to these other environments, and will need to pass the deployment baton off to the system administrators of those farms.
This class will walk you through how you can deploy your applications—without needing to have the administrator who will be deploying the application—have to do much more than type a few keys into the SharePoint Administration Console and press enter, and having full configuration and deployment of your custom SharePoint applications to other environments.

Level: Advanced
Topic Area: IT Pro Essentials

Extracting Solution Packages (WSPs) from SharePoint using PowerShell

I just stumbled across this link from Kirk Evanshttp://blogs.msdn.com/b/kaevans/archive/2011/12/05/extract-a-wsp-solution-from-sharepoint-2010.aspx

Basically, using 3 lines of PowerShell (which can be turned really into one if needed), to extract a SharePoint Solution Package (WSP) from the Farm Solutions collection.

From his post:

$farm = Get-SPFarm

$file = $farm.Solutions.Item("extendeddiagnosticproviders.wsp").SolutionFile

$file.SaveAs("c:\temp\extendeddiagnosticproviders.wsp")

As awesome as it is easy.

PowerShell script to list all Webs and Site Templates in use within a Site Collection

And one more quick post today, this PowerShell script will iterate through all Webs within a Site Collection, print out their Title, URL, and WebTemplate (Site Template) name.

   1: $site = Get-SPSite "http://yoursite"

   2: foreach ($web in $site.AllWebs) { 

   3:     $web | Select-Object -Property Title,Url,WebTemplate 

   4: }

   5: $site.Dispose()

And again, before you use this – please read this: https://gvaro.wordpress.com/2011/03/26/test-out-your-powershell-scripts-first-in-a-non-production-environment-first/ (and also read the comment by Anders Rask)

LotD: Using PowerShell to Approve List Items

The Link of the Day (LotD) goes out to Eric Shupps for this quick PowerShell snippet http://www.binarywave.com/blogs/eshupps/Lists/Posts/Post.aspx?List=89cbe813%2D99f7%2D4257%2Da23a%2D5fefc377336b&ID=241&Web=c7893495%2Dbe3b%2D4d73%2D9875%2D28b039760651. This PowerShell code will loop through a list of your choice and approve list items. This is a huge timesaver for me right at the moment. Thank you Shupps!

I do have some slight changes to the code. There is no need to open the site collection object (line 1), we can just use Get-SPWeb to open the web we need, and, also disposing of the web object at the end, so we don’t leave it sitting around eating up memory on the server.

Normally I do not create posts like this, but, I think I had something to add to it, and, I know exactly where to find it later on, as I am sure I will need it.

   1: $web = Get-SPWeb "http://site"

   2: $list = $web.Lists["Posts"]

   3: $items = $list.Items 

   4:  

   5: foreach ($item in $items)

   6: {

   7:     $item["_ModerationStatus"] = 0

   8:     $item.Update()

   9: } 

  10: $web.Dispose()

And before you use this – please read this: https://gvaro.wordpress.com/2011/03/26/test-out-your-powershell-scripts-first-in-a-non-production-environment-first/ (and also read the comment by Anders Rask)

TEST OUT YOUR POWERSHELL SCRIPTS FIRST IN A NON-PRODUCTION ENVIRONMENT FIRST

You may be wondering why I applied such bad grammar to the title of this post, it came from a comment on this: https://www.nothingbutsharepoint.com/sites/itpro/Pages/Seven-Virtues-for-the-SharePoint-IT-Pro.aspx

PowerShell is a beast. Sure, it’s hard to learn the syntax, and there are 600+ commands that come along with SharePoint 2010. But, it also gives you direct access to the API for SharePoint. Never, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, under any circumstances what-so-ever, run un-tested PowerShell code in a production environment. ever. ever. ever. ever. ever. ever. ever. ever. ever. ever. ever. ever. ever. ever. ever.

What may have worked for one person, in which they have posted it on their blog, mailing list, or company-wide fax – it should be tested first, in a non-production environment.

It may work fine, sure, but, it may also grind everything to a halt, and end your career.

In closing, re-read the above, and make it your mantra. No go fourth, SharePoint admins (and devs – yes you too), and prosper.

Delete a master page in SharePoint using PowerShell

Had one of my group approach me today inquiring about deleting a master page from a site collection using PowerShell. Quick and simple way to do it…

 

   1: $web = Get-SPWeb "http://prototype"

   2: $lib = $web.GetFolder("_catalogs/masterpage")

   3: $file = $lib.Files["v4_copy(1).master"];

   4: $file.Delete();

   5: $web.dispose();

 

So I thought I would share. Enjoy!

Microsoft.BusinessData.Runtime.ExceededLimitException: Database Connector has throttled the response.

If you’ve created a BCS list before (such as defined by the excellent tutorial put together by Laura Rogers for connecting to a SQL data source using a SQL account – http://www.sharepoint911.com/blogs/laura/Lists/Posts/Post.aspx?ID=90), and received this error on your Read List view page:

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:117e242f-0985-42e9-9972-b1a879ce7e3b

After investigating the ULS Logs, located in %SYSTEM DIR%\Program Files\Common Files\Microsoft Shared\web server extensions\14\LOGS, and searching for the correlation id mentioned above. You may find the following error:

Error while executing web part: Microsoft.BusinessData.Runtime.ExceededLimitException: Database Connector has throttled the response. The response from database contains more than ‘2000’ rows. The maximum number of rows that can be read through Database Connector is ‘2000’. The limit can be changed via the ‘Set-SPBusinessDataCatalogThrottleConfig’ cmdlet.     at Microsoft.SharePoint.BusinessData.SystemSpecific.Db.ThrottledIDataReader.Read()     at Microsoft.SharePoint.BusinessData.SystemSpecific.Db.DbEntityInstanceEnumerator.MoveNext()     at Microsoft.SharePoint.BusinessData.Runtime.EntityInstanceEnumeratorBase.MoveNext()     at Microsoft.SharePoint.SPListDataSource.GetFilteredEntityInstancesInternal(XmlDocument xdQueryView, Boolean fFormatDates, Boolean fUTCToLocal, String firstRowId, Bo…

Thanks to the wonders of the interwebs, the solution to this is fairly simple, and the error explanation is extremely helpful. Do a search for this: Set-SPBusinessDataCatalogThrottleConfig, which will lead you to a great article on the Microsoft Business Connectivity Services Team Blog by Adam Outcalt here: http://blogs.msdn.com/b/bcs/archive/2010/02/16/bcs-powershell-introduction-and-throttle-management.aspx which will give you very great instructions on modifying the BCS throttling configuration.

Be careful with this however, the throttling is there for a reason. Not just to give you another option to configure.

SharePoint & PowerShell 101: Finding Cmdlets

imageI recently did a post on Listing all available PowerShell commands in SharePoint 2010. That is all well and good, if you want to manually browse through all of them. But what if you want to search for them?

 

Get-Command

Get-Command is a highly useful cmdlet in PowerShell. Today we are just going to use a basic functionality of it, to help us find and locate the cmdlets we need to use. Today, we need to do some work with the User Profile Service. However, we don’t know what the command names are that we need to use, only that we need to use them. For that, we can use Get-Command. If you need to figure out how to use the Get-Command cmdlet, run

Get-Help Get-Command

Which will return the following information about the cmdlet

image

This will return the usage of the Get-Command cmdlet. We are just going to use the –Noun switch to pass in our parameters.

Let’s start looking at the basics… we’re looking to find commands relating to the User Profile Service. So, let’s try searching for a noun of Profile

Get-Command –Noun Profile

Nothing is returned… oh right, it would appear that the Get-Command is literal, not a wildcard. However, we can use a wildcard character to help us search, as we have no idea what the name of the command is. Let’s try searching for *Profile*, that should do the trick.

Get-Command –Noun *Profile*

image

Hooray, results! However, we cannot see the entire name of the results returned. For that, we can use the Select-Object cmdlet.

Fore information on using that, try this in the PowerShell console

Get-Help Select-Object

So, let’s only pull the Name property in our results of the Get-Command

Get-Command -Noun *Profile* | Select-Object –Property Name

image

Much better! We can further refine these by adjusting our Noun, to just look at ProfileService

Get-Command -Noun *ProfileService* | Select-Object -Property Name

image

And there we go! Hopefully this helps you in your quest to add PowerShell to your arsenal of SharePoint management and development tools.

I’d love to hear what else you would like to learn about – leave me information in the comments!

%d bloggers like this: