Archive

Archive for April, 2012

Login for ‘Sharepoint_Config’, Login failed for user ‘Domain\ComputerName$’ – SCOM agent

April 26, 2012 2 comments

This is about a recurring error in the event log, that does not really affect SharePoint but stirs up a lot of fuss…

(Update added 2012-12-11 – permissions needed for the agent account, see note below)

Perhaps you have encountered this error in your event logs:

database login for ‘Sharepoint_Config’ on instance ‘SQLServer\SharePointInstance’ failed. Additional error information from SQL Server is included below.
Login failed for user ‘Domain\ComputerName$’.

I have seen this a couple of times and in both cases it was due to the MOM/SCOM Agent that has a SharePoint management pack installed, the agents Windows Service runs as ‘Local System’ and thus causes this. The agent tries to access some information from the Configuration database and when accessing the database as the SharePoint Server’s ‘Local System’ account, it gets access denied, this is as it should be, the local system account must never get access outside of the server and especially to the config database.

The workaround in the cases I have seen this so far, is to either kill the SCOM agent service, or set it to run as a dedicated service account. The later is the one that sound better to me, so I will try and add info on how exactly this is done in an update to this post later.
What probably should be done when installing the Management pack, and this my personal guess so far, is that the service account for the agent, should be given the Add-SPShellAdmin permission on the Config database. This is completely unconfirmed, but if any of you would confirm that this is required, please post me a note.

On a personal note, this error caused by the monitoring agent, has been the cause of a lot of comotion and has in the end had me spend hours of unnessesary hours on finding it and mitigating its effects and also calming down the operations people that think my farms have broken…

(Updated 2012-12-11)
Note:
The required permissions for the configured run as account on an individual SharePoint farm are:
•Local admin on all SharePoint 2010 Front End and Application Servers
•Local admin on all SQL machines that host SharePoint 2010 databases
•Full Farm Administrator rights within SharePoint 2010
•DBO for all SharePoint databases
(From: http://support.microsoft.com/kb/2690744)

Enjoy!

Regards

 

SPB usage guide – 2 Configuration and Modification

April 4, 2012 44 comments

SPB usage guide – 2 Configuration and Modification

This is the guide on how to install and use the SharePoint Branding Project.
Download: Visual Studio gallery

The guide is devided into three parts:

1 Download and Installation

2 Configuration and Modification

3 Deployment and verification (soon to be released)

In part 1 of this guide, we left off at the new project dialog:

In the categories, select C#, SharePoint, 2010 and SharePoint 2010 Branding Project.
Name the project(This name will also be the name of the SharePoint Feature), select its file location and Click OK.

Clicking on OK will create a new project for you in Visual Studio, the project will be a complete branding solution ready to deploy or package and install to a SharePoint 2010 farm or even an Office 365/SharePoint online tenant.

The first thing that you will see is the SharePointBrandingProject in the solution explorer:

The solution will by default have a number of components and functionalities.

Custom SPB Masterpages for:
Team sites MyBranding.master, equivalent to the general V4.master.
Meeting Workspaces MyBrandingMWS.master, equivalent to the general MWSDefaultV4.master.
Team sites MyBrandingMinimal.master, equivalent to the minimal.master.

Custom SPB StyleSheets:
MyStyles.css, Contains styles for basic look and feel for most sites and is used in all masterpages.
MyStylesMinimal.css, This is an additional stylesheet loaded and used when the MyBrandingMinimal.master is loaded.

Custom logo:
logo.png
Custom Favicon:

favicon.ico

Custom Eventreciever:
ChildSiteInit, This handles the web provisioned event to apply branding on new subsites.

Custom Feature:
Main, This feature applies the branding to the rootsite and all subsites.

In order to deploy this solution directly from Visual Studio to your test site, enter the url of you site collection in the project properties:

Now you are ready to deploy the solution to SharePoint with the default branding. The default branding is good looking and all that, but perhaps you want to make a few changes first? I would however recommend that you try the deployment so that you can verify that everything really works and that you have the permissions needed and so on. After successful trial deploy and complete awe for the good looking SHarePoint you made for yourself, it is time to start changing the branding.

First thing you will want to do, is replace the logo and favicon(if you did not know this, the favicon is the small tiny image that is located to very left in the address field in your Internet Explorer browser(I guess FF and others too). The favicon is loacated in Solution Explorer in the Images folder under the Style Library/My Branding/Images/
You can replace this file with a new favicon using the same name, but it must have the same properties: 32×32, a 24bit bmp .ico file. There are applications that are made just for the purpose of creating icons available. Or there is a plugin to PhotoShop available if you have access to PhotoShop (ICO (Windows icon) plugin). You can also edit the icon right here in Visual Studio but that is probably not for the thorrow artists…

Same story with the logo, it does not have the same rigorous restrictions on the size and type, but it should be close to what is the default size, use a too big or small image and you will have to make adjustments to the master/Stylesheets to compensate.
The logo can be edited in Visual Studio but that is not something that you do, use a proper image editing application, or simply adjust you current company/Organization/Customer logo to fit. I will now show you how you replace the default logo file with your own custom logo:

The current logo, logo.png – 120×120.
Delete the default logo by right clicking on the imagefile in the solution explorer and Click Delete:

Click OK in the confirmation dialog:

Now the logo file is deleted and we have to replace it with our new custom logo file. For simplicity, use a PNG file if you have one (if you don’t, use another file but then you will HAVE to edit the feature that adds the logo to the site).
To add the image, Right Click on the Images flder in solution explorer, then select Existing Item and Add:

Browse to your logo file in the explorer window, it can be located locally, or on a fileshare somewhere. Select the file and Click Add:

Now the imagefile is added, in my case I have found a wonderful logo from back in the days, when SharePoint 2001 was the talk of the town. SharePoint Portal Server 2001 had a pretty mean logo, this is what I’ll be using in my demo. See this guide part 3 for a presentation of that logo in action.

For the branding project to recognize the image as the logo, it will have to be renamed to logo.png (unless you used another fileformat or if you want to edit the feature to fit anyway).
Right Click on the Image in the Solution explorer window and select Rename.

Beautiful! The solution is again ready to be deployed:

Before we deploy the solution, I want to just quickly show you the basics of how you edit the real source of the branding solution, the master pages and the stylesheets. What you do is that you in Solution explorer, Double Click on the master or stylesheet you want to edit or look at. Try that and you will see something like this for the master:

And this if you Double Click on a StyleSheet(css)…
Did you know that CSS actually stands for Cascading Style Sheets, Cascading comes from the order in which they are applied, the classes in the last css to be applied overruns the previous even if they contain the same classes.

Now we are ready to deploy. So, how do we do that? From Visual Studio, you simply do it in a few Clicks, or really, its just two Clicks away.
Right Click on the Project in Solution explorer, Click Deploy.

Verify that the deployment went ok:

In my case, it did! Happy happy! Over to the browser and verify the new look and feel, go to the site, if allready there, refresh the page.

This is what my site looks like with that beautiful replaced retro logo, don’t you just love it?

In the next section of this guide, I will show you what the branding does and what you will see in the browser ‘onsite’.
The next part is called:

3 Configuration and Modification (soon to be released)

See also the previous part:

1 Download and Installation

Stay tuned!

Enjoy!

Regards

Twitter | Technet Profile | LinkedIn

 

SPB usage guide – 1 Download and Installation

April 4, 2012 10 comments

SPB usage guide – 1 Download and Installation

This is the guide on how to install and use the SharePoint Branding Project.
Download: Visual Studio gallery

The guide is devided into three parts:

1 Download and Installation

2 Configuration and Modification

3 Deployment and verification (soon to be released)

Hi friends.

Allow me to welcome you on a journey to the wonderful world of SharePoint Branding. I created this SharePoint Branding Project thinking that the overhead and the learning curve to just get started with branding, was way too high. The amount of blogs to read and discard until you could actually build you very first, very basic custom branding solution, it was rediculous! Now pretty recently, the guides on Technet have been improved and most of them actually work, but it is still a long way to go if you want to start from scratch with little or no knowledge about how you go about creating such a project in Visual Studio.
With the SharePoint Branding Project, you can brand your company, organization or customer SharePoint in about 10 minutes, and you will have full control doing so. Follow this guide and you will cruise all the way to the finnish line.
To use this template, you need a SharePoint 2010 and Visual Studio on the same machine. If you can follow instructions, then you can achieve this.
Now, lets get started and have some fun, this IS fun after all!

There are two ways to download the extension file from the Visual Studio Gallery, the first is to simply go to the Visual Studio gallery, Click SPB.
Then on the large purple button, Click Download.

In the annoying but useful IE download bar, Click Open.

Click ‘Install’ to install the extension into Visual Studio.

When the extension is installed you will get a ‘Complete’ notice. Click Close in the dialog.

You are now done downloading and Installing the actual extension and you can now move on to the interesting stuff,  to create a SharePoint Branding Project in Visual Studio.
But before we go into how, we will show you another way to install the extension. From Visual Studio Extension Manager. The extension manager will show the installed extension regarless of the way you installed it, here you will also be notified of updates that have been released of the same extension.
Follow these steps from Visual Studio:

Start the Extension Manager from Visual Studio, Tools menu, Click Extension Manager

Click Online Gallery and search for SPB or browse the ‘Templates’ category and ‘SharePoint’ and you will find the SPB extension.
Click Download and the file will download and initiate the installation. Click Install in the next dialog:

When the extesion have been installed, you can’t wait to get going with the branding right. Ok, we will start that part, regardless of the way you choose to perform the download and installation, and the installation (Which is very quick) has completed, in Visual Studio, select File, New and Click Project:

In the Installed Templates section, select Visual C#, SharePoint, 2010 and SharePoint 2010 Branding Project.
Name the project (This name will also be the name of the SharePoint Feature once deployed to SharePoint), select the projects file location and Click OK.

Now you are done with the installation and can move on to the next step in this guide:

2 Configuration and Modification

or jump directly to the last step, not recommended:

3 Deployment and verification(soon to be released)

Stay tuned!

Enjoy!

Regards

Twitter | Technet Profile | LinkedIn

 

Replace all instances of a user in Last Modified and Created By using PowerShell

April 2, 2012 2 comments

If you for unknown reasons end up with the wrong user in the last modified and author field of documents and folder, or if you simply want to replace a user with a differerent user account, then you can use this script to do it in all documents and flders within an SPWeb.

The script below will iterate thru the Shared Documents library, replace every ‘Last Modified'(Editor) and ‘Created By'(Author) with the user with ID 405.

[Reflection.Assembly]::Load(“Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”)
# don’t leave out the last “/” in the url
$SPSite = New-Object Microsoft.SharePoint.SPSite(“http://www.mycompany.com/“)
$SPWeb = $SPSite.OpenWeb(“MySite”)
$SPList = $SPWeb.Lists[“Shared documents”]
$SPListItemCollection = $SPList.Items
foreach ($ListItem in $SPListItemCollection)  {
   #This example gets the user with ‘SharePoint ID’ of 405.
    $SPFieldUserValue = New-Object Microsoft.SharePoint.SPFieldUserValue ($SPWeb,405)
    If ($ListItem[“Editor”] -eq “1;#Chuck Norris (Admin)” -or $ListItem[“Editor”] -eq “385;#Bruce Lee”) {
        $ListItem[“Author”] = $SPFieldUserValue
        $ListItem[“Editor”] = $SPFieldUserValue
        $ListItem.Update()
    }
}

# Do the same for all folders

$SPListItemCollection = $SPList.folders
foreach ($ListFolder in $SPListItemCollection) {
    $SPFieldUserValue = New-Object Microsoft.SharePoint.SPFieldUserValue ($SPWeb,405)
    If ($ListFolder[“Editor”] -eq “1;#Chuck Norris (Admin)” -or $ListFolder[“Editor”] -eq “385;#Bruce Lee”) {
        $ListFolder[“Author”] = $SPFieldUserValue
        $ListFolder[“Editor”] = $SPFieldUserValue
       $ListFolder.Update()
    }
}
$SPWeb.Update()
$SPSite.Dispose()

Remember though, the last modified date will be updated to the current date.

Stay tuned!

Regards

Update the UI quick on ALL subwebs with SPWeb.UIVersion

April 2, 2012 Leave a comment

When you migrate SharePoint 2007 to 2010, it sometimes happens that the UI gets ‘stuck’ in v.3.0 mode. When you move a database from 2007 and do an attach upgrade, you have a choice to use the -UpdateUserExperience flag when you run the Mount-SPContentDatabase command. This is usefull so that you don’t have to manually update the Visual UI, but this flag can be dangerous as well.

I have used it and sometimes, it causes most sites UI to be upgraded to v.4, but not all. On the not upgraded, the option to upgrade the visual UI is gone which puts you in the spot a bit.

For this occasion, I created this short but effective snippet:

$SPSite = Get-SPSite http://MySiteCollection
foreach ($SPWeb in $SPSite.AllWebs)
{
    $SPWeb.UIVersion = 4;
    $SPWeb.Update();
}

Done!

Stay tuned!

Regards