Category Archives: Administration

How to tips for SharePoint 2010 or Sharepoint 2013

This is more of a “Note to Self” entry with four quick tips I found myself looking for quite often in the last couple of weeks.

If you happen to have stumbled on this post, you probably are looking for the same thing, so Enjoy!

  • How to retrieve a list of master pages for all sites in a web application
  • How to retrieve the SharePoint connection sting, which will also list the name of the configuration database associated with your farm. Extremely helpful if you have more than one configuration database setting in the same SharePoint environment, which happens not to be yours!
  • How to reset the SharePoint passphrase for SharePoint, since you can’t retrieve it in PowerShell [to my knowledge]
  • How to grant site collection administrator right to all site collections

So here we go:

How to retrieve a list of master pages for all sites in a web application

Run this PowerShell command on the SharePoint application server

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Get All site collections

$SiteCollections = Get-SPWebApplication | Get-SPSite -Limit All

#Loop through all site collections

foreach($Site in $SiteCollections)

{

#Loop throuh all Sub Sites

foreach($Web in $Site.AllWebs)

{

$MasterPage = $Web.GetFile($Web.MasterUrl);

$MasterPage.Name  +” : ” +$Web.Url

}

}

How to retrieve the SharePoint connection string, which will also list the name of the configuration database associated with your farm

From the SharePoint application server

  • Open regedit [Start > Run > “regedit”]
  • Navigate to [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\Secure\ConfigDB]
  • Open the [dsn] key.
  • It should look something like this.
  • Data Source=sp2010srv;Initial Catalog=SharePoint_Config;Integrated Security=True;Enlist=False;Connect Timeout

How to reset the SharePoint passphrase for SharePoint, since you can’t retrieve it in PowerShell

Run the following PowerShell from the SharePoint application server

  • Enter the following prompt: $passphrase = ConvertTo-SecureString -asPlainText –Force
  • Input the new passphrase and hit enter
  • Enter this at the PowerShell prompt: Set-SPPassPhrase -PassPhrase $passphrase -Confirm
  • You will be asked to confirm the passphrase by re-entering it
  • Re-enter the passphrase and hit enter
  • You will be asked if you are sure that you want to perform this action. Type Y for yes and hit enter
  • Your farm passphrase is now reset

How to grant site collection administrator right to all site collections

Run the following PowerShell from the SharePoint application server

$scadmin = “domain\user”

$Sites = Get-SPsite

foreach ($site in $Sites) {

Set-SPSite -Identity $site -SecondaryOwnerAlias $scadmin

}

Where To Find Web Part Pages In SharePoint 2013

This is take-2 with Microsoft SharePoint Server 2013. Take-1 was not able to log in as a different user, too painful when you have to log in as someone else to see what their experience is. I had blogged about how to work around that on a previous post.

This time around, it is a little less serious, but still big enough in my world. When I build SharePoint sites, I use web part pages to design my page layouts and add web parts and such and the flexibility of being able to lay such content on different zones and connect web parts together hits home for me. In SharePoint 2007 and 2010 when you click Add More to create a new list, you see web part pages as an option along with just regular pages.

Well, to my surprise, with SharePoint 2013 you can only add a wiki page from either the site settings icon drop down menu or if you click on add an app. The web part page “app” isn’t surfaced on the interface? Why, not too sure. But the good news is that it is still there. Yes!

To add a web part page simply go to your site pages library and hover your mouse over Add document to see the web part page option. Too sneaky, or silly, but I personally can’t live without it.

Hope you found this helpful

Here is a video on how to get to the web part pages in SharePoint 2013.

Setting Permissions on a SharePoint List View

Have you ever stumbled on not being able to set permissions on a list in SharePoint?

Well, I received this requirement again last week, but this time I was able to find a workaround solution.

Requirement:

Build a simple time off report list for your organization. All regular employees will use the list to add and view their own time off report records. HR members should also have access to the list but should see everyone’s’ time off report.

Dilemma: the list is one; the permission levels for regular employees and HR members are different. So how do we configure different views and setup different permissions so that both entities (employees and HR member) can view what they are supposed to view?

Well, here is the workaround:

  1. Create the list. In my example above I called it Time Off Report.
  2. Set the right permissions on the list. In my example above, regular employees have contributor access and HR members has full access. These can be AD groups, SharePoint groups, or direct users.
  3. Create a web part page for HR members and set permissions for that page to be only accessed by HR, give them full access.
  4. Drop a web part on the web part page and bind it to your list. In my example Time Off Report list.
  5. Go back to the main list (“Time Off Report”) and change the default all items view to filter based on “created by”. The filter option is listed beneath the list of columns as part of the list view options. This way the default view for everyone is their own content.
    • Note: this step will prevent HR from viewing any records off the main list, which is okay since we are giving them their own page to view records from. Of couse, unless they will or have created their own time off report items.
  6. If needed, add links to both the default all items view and to the web part page for easier navigation and access by the different groups on to the top link bar.

Note: You have to configure it in the order shown, especially step 2 has to come before step 5.

The video below walks through the above example.

The video length is: 4:57

Exploring SharePoint 2013 Themes

If you are like me then you’ll probably try out all SharePoint 2013 themes before you decide on one. But we all know how time consuming this exercise can be so I’ve taken the time to go through them and I’d like to share the look and feel with you so you don’t have to go through it.

The video below rotates through all SharePoint 2013 out of the box themes. There are 13 different themes and they are:

Office | Blossom | Breeze | City | Sea Monster | Nature |  Characters | Sketch | Orbit | Immerse | Wood | Green | Purple

Enjoy the 3:04 minute video!

Working With Site Collections And The Get Started Web Part in SharePoint 2013

There is nothing specific in this post about site collections per say. However, I just wanted to get a feel for how things are done in SharePoint 2013 and so I went ahead and created a site collection, played a bit with the getting started web part now part of the home page and navigated around. The video post below walks through some of that. Enjoy!

Video length: 6:03

List Site Templates and IDs in SharePoint 2010 Using Windows PowerShell

One of the main checkpoints you will have to worry about as you upgrade or migrate SharePoint sites across farms or versions are custom site templates and how they are handled during migrations. You may upgrade or migrate custom site templates as is or you may elect to re-template site templates. A perfect place to start would be to know what custom site templates you have. So I did some research and finally stumbled upon a couple of scripts that I want to share with you. These scripts will help you:

  • List all site collections within a web application <– This will give us a better understanding of the total number of sites we may consider for migrations
Get-SPWebApplication “http://WebAppAddress“| Get-SPSite -limit ALL|Get-SPWeb -limit ALL|Select-Object Title,Url
  • List all site templates and template IDs for a given web application <– So we end up knowing what is standard and what is custom
$webapp = Get-SPWebApplication -identity http://WebAppAddress/
$webtem = Get-spwebtemplate
foreach ($site in $webapp.Sites)
{
 $spweb = get-spweb $site.URL
 write-host “Site URL: ” $site.URL
 write-host “Web Template: ” $spweb.WebTemplate
 write-host “WebTemplateID: ” $spweb.WebTemplateID
 write-host “————————————-”
}
  • List site template and site ID for a given site <– If there is a specific site we want to migrate and are interested in knowing what template it was created from
$web = Get-SPWeb http://webapp/sites/site/subsiteaddress
write-host “Web Template:” $web.WebTemplate ” | Web Template ID:” $web.WebTemplateId
$web.Dispose()
  • In general a list of all site templates available <– If you just want to see what site templates you have
 Get-SPWebTemplate | Sort-Object “Name”

I’ve recorded a short video to demonstrate the above.

Video length: 3:56

Ghazwan Khairi

SharePoint Quester

Using the Datasheet View to Bulk Update SharePoint 2010 List Columns

As I was digesting my SharePoint caffeine dose for the day, I came across a question that asked if there is a way to perform bulk updates on a SharePoint list column so I figured that is easy enough to record and share.

I know this can probably be done with PowerShell, but I used the Datasheet View along with the “Fill Down” action to demonstrate how that can be done. Enjoy!

Video length: 2:30

Ghazwan Khairi | a.k.a SharePoint Quester

Display Lists & Libraries That Use a Specific Content Type in SharePoint 2010

SharePoint content types encapsulate data requirements, enable content standardization, and are independent of file formats which makes them popular to use across SharePoint. Fast forward to a few hundred content types used within a large SharePoint environment and you’ll soon need to pay attention to managing these content types and answering question such as how many custom content types do we have and where are they being used.

A specific scenario this post addresses is the need to report on a specific content type use within a site collection. The video and script below highlight the process you’d need to take to generate such a report.

Video length: 2:24 min

To list a specific content type usage within a site collection copy and paste the following script into the SharePoint 2010 Management Shell.

Note: Two things to change: 1. The site collection address and 2. The content type name

 $webs = get-spsite http://sharepoint2010/sites/portal14| get-spwebforeach ($web in $webs)

foreach ($lst in $web.lists)  
{    
foreach ($ctype in $lst.ContentTypes)    
{      
if ($ctype.Name -eq “Document”)      
{ $lst.DefaultViewUrl
}   

}  
$web.Dispose()
}