Posts

Showing posts from 2014

Hide Recently Modified from left nav

<style type="text/css"> .s4-recentchanges { display:none; } </style> The code above, added through the html view of a content editor webpart will remove the "recently modified" list from the left nav of a sharepoint 2010 site.

EasyTabs

Image
I come back from vacation and my coworkers are using EasyTabs on all our SharePoint 2010 home pages.  This does an excellent job of quickly and easily creating a tabbed interface for putting lists and libraries on the front page without all that tedious scrolling or content overload. Check it out: http://www.pathtosharepoint.com/pages/easyTabs.aspx  

Sleepy Time for SharePoint 2010 PowerShell

Sleepy Time for SharePoint 2010 PowerShell There are times when you'll want SharePoint to wait and perform an action later.  In my case I wanted someone to start a script when it was at the end of their shift while a file copy was still running on my side with an hour left before it would complete. Start-Sleep -s 60  (sleeps for 60 seconds) Start-Sleep -s 5400 (sleeps for 90 minutes) There's an option for miliseconds, but no minutes or hours setting.

Recycle Bin still not removing files SharePoint 2010

Image
We ran into an issue as we had a site collection that we wanted to save off as a template for creating new site collections.  The problem was all the documents were still there and the backup file was 20 GB large. The first thing to do was create a backup and then restore it to a new site collection.  After that, we deleted all the documents.  Next, we cleared out the recycle bin.  Then we cleared out the site collection recycle bin. The backup of this site collection was still the same size (20 GB). Next, I ran a script to list all the files.  I found that the deleted files were still there. Here's that script: select type, dirname, LeafName, size, TimeLastModified  FROM [WSS_Content_Delete].[dbo].[AllDocs]  where (TimeLastModified < '2013-01-02')  AND (Size is NOT NULL)  AND (LeafName not like '%.aspx')  and (DirName not like '%_catalog%')  and (DirName not like '%Style Library%')   and (DirName not like '%_themes%...

Save a site as a template when the option is not available

Image
Save a site as a template when the option is not available - SharePoint 2010 The option (under Site actions, site settings) to Save Site as Template exists for a team site, but not a collaboration site.  To use that function anyway you'll need to hand edit your URL http://sharepoint.name/site1/_layouts/savetmpl.aspx Simply hand add everything from  _layouts onward to access this hidden page.  

Tagging your SharePoint 2010 servers

Image
Tagging your SharePoint 2010 Servers for debugging purposes There are times when you'll need to know which server you're connecting to to try to debug an issue.  If you're using load balancing, that can be pretty tricky, but here's an easy way to tell at a glance. Here, the help icon (normally a ?) has been replaced with a number 2.  It still functions as help, but it's an easy way to tell where you are.  To make this change you'll need to edit the FGIMG.PNG file found at: c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\IMAGES on every server.  You'll need a graphic editor that can preserve transparency, or else the blue ball will have a white square around it.  I use paint.net which is free( www.getpaint.net ) I also chose to tag my app servers in black to differentiate them from web servers, because our naming conventions reuse 1,2,3. Below are the graphics you can download.  If you find this useful, let me know. ...

Creating a Second SharePoint Farm on a SQL Named Instance

Image
Creating a Second SharePoint Farm There are times when you might want to create a second SharePoint Farm that uses the same content as an existing Farm.   A second URL can be accomplished by creating an alternate access mapping, but that uses the same farm, same search, user database, service applications, etc.   To create new versions of all of that from scratch, you need to create a second SharePoint farm. The Second Farm method is also useful when you want to keep the same SQL server machine and the same content while performing an upgrade of everything else. First, create a second SQL Instance.   You’ll need the SQL Server 2008 R2 install media.   Run through the install as if you’re doing a fresh install, but you’ll create it as a Named Instance.   To access a SQL Server Named Instance, use SERVERNAME\InstanceName. Create a new web front end (WFE) server.     Install SharePoint and f...

Fixing: The workbook cannot be opened SharePoint 2010

Fixing: The workbook cannot be opened in SharePoint 2010 The error "The workbook cannot be opened" is thrown when opening an excel file in the browser or visiting a page with an excel page viewer webpart embedded. This is a failure in Excel services. To check that the service was added, go to Central Administration (CA) and click "Manage Service Applications" In that list you should see Excel Services Application Web Service Application and Excel Services Application Web Service Application Proxy. Then, you need to know that excel services is running on at least 1 server in your farm. Go back to the CA homepage and click "Manage Servers in this Farm" There you should also see "Excel Calculation Services".  If not, click on one of your app or web servers on that page  then click the link to start the service. Next we need to know which service account is running Excel services.  In CA, click "Security" then "Configure Service Accou...

Fixing: Manage Content and Structure in SharePoint 2010

Fixing: Manage Content and Structure in SharePoint 2010 After my "C" network migration, the link for Manage content and Structure under site actions was failing. Looking through the logfiles I found the relevant error: Failed to determine the setup path of the list schema for feature {e32e1e6f-fb94-4090-...}, list template 100. I googled the GUID, and came up with nothing. This was not one of the standard site features. This was some golden nugget of excrement that a prior admin must've found and installed on a whim. Or something useful. Or a Fab 40 Template. Hard to say which with nothing to go by but a guid. I searched web configs with no success. To find out which list was the offending one I had to open all the lists. Never mind sites and document libraries, just lists as the error said "list". I went to site actions, view all site content and popped each list open in a new tab. All of them came up but one (fortunately). This list was ...

Fixing: The file /_catalogs/masterpage/_controltemplates/Welcome.ascx does not exist.

The file /_catalogs/masterpage/_controltemplates/Welcome.ascx does not exist. This was the error I found in the logfiles as the page gave the usual correlation ID of head scratchiness.  In my case it was popping up only when users were creating a new page, but there are several places you could hit this.  some might even case a whole site to come up as a 404 error. In IIS you will find _controltemplates, but no _catalog.  Resist the urge to create a _catalog, just like I didn't.  This won't fix the issue, but will move your error along. After some googling, I found this tidbit : Most likely the tilde sign "~" has dissapeared in your references on the masterpage after editing it in the sharepoint designer. In the beginning of the masterpage you have register statements that should look like this Code Snippet <%@ Register TagPrefix="wssuc" TagName="Welcome" src="~/_controltemplates/Welcome.ascx" %> <%@ Reg...

More complex script when full file paths are required

This one is not my script, but it's too useful not to share.  I ran into an issue while trying to move from a source of SQL 2008 to a destination of SQL 2008 R2 that my restore failed because the file paths were not the same.  So I used this script to generate the backup and restore commands. SET NOCOUNT ON DECLARE @Table TABLE (LogicalName varchar(128),[PhysicalName] varchar(128), [Type] varchar, [FileGroupName] varchar(128), [Size] varchar(128),             [MaxSize] varchar(128), [FileId]varchar(128), [CreateLSN]varchar(128), [DropLSN]varchar(128), [UniqueId]varchar(128), [ReadOnlyLSN]varchar(128), [ReadWriteLSN]varchar(128),             [BackupSizeInBytes]varchar(128), [SourceBlockSize]varchar(128), [FileGroupId]varchar(128), [LogGroupGUID]varchar(128), [DifferentialBaseLSN]varchar(128), [DifferentialBaseGUID]varchar(128), [IsReadOnly]varchar(128), [IsPresent]v...

SQL script to backup and restore SharePoint 2010 databases

Here's a finished version of my SQL script to backup and restore SharePoint 2010 databases. I discuss the idea in detail here: http://www.sharepoint.name/2014/04/make-sql-server-write-its-own-scripts.html But this is the more finished version This script is one simple query that generates a column containing each command. SELECT 'BACKUP DATABASE ['+ name +'] TO DISK = ''\\SERVER102\B$\SQL\FULL\'+ NAME +'.BAK '' WITH STATS=10' AS FullBackup, 'BACKUP DATABASE ['+ name +'] TO DISK = ''\\SERVER102\B$\SQL\DIFF\'+ NAME +'.BAK '' WITH DIFFERENTIAL, STATS=10' AS DiffBackup , 'RESTORE DATABASE ['+ name +'] FROM DISK = ''\\SERVER102\B$\SQL\FULL\'+ NAME +'.BAK '' WITH NORECOVERY, REPLACE' AS FullRestore , 'RESTORE DATABASE ['+ name +'] FROM DISK = ''\\SERVER102\B$\SQL\DIFF\'+ NAME +'.BAK '' WITH RECOVERY' AS DiffRestore from s...

Edit User Profile Data in SharePoint 2010

Edit User Profile Data in SharePoint 2010 This a useful little quick fix.  The better way to fix your bad data is through the AD sync.  If you do change data through this method for expediency, be sure to check it in AD as well or you risk your changes being overwritten. Log in to Central Admin Click Application Management Click Manage Service Applications Click on the User Profile Service Application Click Manage User Profiles Search for the user Click the user and select Edit my Profile Make your changes Click Save That's all it takes to edit the profile.

Step by step how to migrate a SharePoint 2010 SQL Server

Here's a 4 step method to migrate SharePoint 2010 data from 1 SQL Server to another. This was the method I used for the "S" Network, combined with other steps, but this process migrated the data. First, the commands.  Each step is actually a script that hits each database.  I chose to write out each command on a new line and just run it in the SQL query window. See http://www.sharepoint.name/2014/04/make-sql-server-write-its-own-scripts.html  for that script. BACKUP DATABASE [NAME] TO DISK = '\\PATH\FULL\NAME.BAK' RESTORE DATABASE [NAME] FROM DISK = '\\PATH\FULL\NAME.BAK' WITH NORECOVERY, REPLACE BACKUP DATABASE [NAME] TO DISK = '\\PATH\DIFF\NAME.BAK' WITH DIFFERENTIAL RESTORE DATABASE [NAME] FROM DISK = 'PATH\DIFF\NAME.BAK' WITH RECOVERY Here's the explanation Start with a full backup of Production. This can be done without downtime. Restore to the NEW SQL database server. During the ASI downtime window turn off access t...

Make SQL Server write its own scripts

Make SQL Server write your scripts for you! Say you want to create a T-SQL script to backup every database on your SQL Server and there are over 100. You can obtain a list of all your databases with the following command: SELECT NAME FROM sys.databases That lists all databases on that SQL server.  You can also add literal text in your query. This is a valid query: SELECT 'Do not forget to back up database ', NAME FROM sys.databases That gives you two columns, but you could also make it one column with a + instead of a comma SELECT 'Do not forget to back up database ' + NAME FROM sys.databases I went a step further and got this select statement to generate my backup statements SELECT 'BACKUP DATABASE ' + NAME + ' TO DISK = ''C:\' + NAME + '.BAK'' FROM sys.databases Note: Those are all single quotes above. Two single quotes are used to place a single quote (escape character). The output looks like: BACKUP DATABASE ...

InfoPath 2010 get the highest or lowest value from two or more disparate fields using Rules

Image
InfoPath 2010 get the highest or lowest value from two or more disparate fields. I was working on an InfoPath 2010 project where I would pull in the pilot, copilot and crew with the respective hours of flight experience.  Then I needed to know the lowest number because that determined the highest risk factors.  They could then mitigate those risks, but it was important to identify ahead of time the risk factor for the mission. Since the data came from different fields, I could not use the max or min functions built in for a repeating row.  The display requirements also didn't fit repeating table either, so even if I could smush my data into one, I'd have to pull it back out to fit the display requirements. I created a button that executed a series of rules.  There is no IF THEN ELSE for InfoPath 2010 rules, so I needed to use a little trickery and some Algebra.  I had a field named DayRisk1 .  Clicking the button first sets the field to 10,000...

SharePoint 2010 Powershell script to restore a Site Collection from a Backup.

SharePoint 2010 Powershell script to restore a Site Collection Backup Here is my script I wrote to do a restore from a Site Collection Backup. This will create a new content database for the site collection.  It made sense for us to do this because each site collection was a military unit that could be redeployed and they might want to take the database with them. Since I was re-running my script, (and timing the job) I started out by deleting the site collection.  Unless you're doing the same, you will not need this: Get-SPContentDatabase -Identity "WSS_Content_SiteCollection1" | Remove-SPContentDatabase -Confirm:$false Note: That's all one line ^ New-SPContentDatabase -Name "WSS_Content_SiteCollection1" -WebApplication http://sharepoint.name Note: That's also all one line ^ Wait, did I just delete a site collection only to add it back???  Yes I did.  As I was running the restore job multiple times I wanted to be sure the previous attem...

SharePoint 2010 Powershell script to create a Site Collection Backup

SharePoint 2010 Powershell script to create a Site Collection Backup Backup-SPSite -Identity http://sharepoint.name/sitecollection1 -Path \\UNCPATH\to\save\location\sitecollection1.bak This command will make the site collection read only while it runs. In order to leave the site writeable, use the versin below Backup-SPSite -Identity http://sharepoint.name/sitecollection1 -nositelock -Path \\UNCPATH\to\save\location\sitecollection1.bak This can be batched.  Just save the file as a .ps1 file and then open powershell, navigate to the path where the file lives, and type .\filename.ps1 This displays no output though, so I added text output to tell me the time a backup started and when it finished. The finished script is below. $StartDate = Get-Date; "Started SiteCollection1" Backup-SPSite -Identity http://sharepoint.name/sitecollection1 -Path \\UNCPATH\to\save\location\sitecollection1.bak $EndDate = Get-Date; "SiteCollection1: Started at $StartDate and ...

Migrating a fragile SharePoint 2010 farm to new hardware.

When I first became Administrator of the "C" SharePoint 2010 portal (real name classified) I noticed how delicate it was, and how riddled with errors the logfiles were. "You've had some cowboys in here", I thought.  Search was not working.  The search service that was trying to run was calling a database that was missing from SQL server. A previous admin deleted that database from SQL; SharePoint had no idea and was still looking for it. The owner of most of the content databases was the previous admin's elevated account.  Services were running under that account as well.  It was only a matter of time before that account expired and got removed causing the farm to crash. The SharePoint Service accounts were unmanaged and I only had the password to one of them. There was 2.2TB of data in SQL server contained within over 60 site collections and 60 content databases.  Each Site collection got its own content database. The SharePoint servers had nev...

Moving SharePoint 2010 to a new SQL Server

As a part of an Enterprise SharePoint 2010 portal migration to new hardware, I had developed a plan to utilize a new SQL server. I found this article which gives direction to move all databases. http://technet.microsoft.com/en-us/library/cc512723(v=office.14).aspx This one uses a database detach and restore along with a SQL alias to trick SharePoint into thinking it is still pointing to the old server. The database detach and restore method will not work for us as we have over 1TB of data and around 50 databases to move in a small ASI (outage) window. I planned to adapt this by backing up from the old, restoring to new, with the SQL alias to redirect. This is touched on in the technet article, but there's no detailed instruction there. Here was my plan Back up all the sharepoint databases including the sharepoint_config db; Restore them to the new server Add a WFE (web front end) to the current farm (not in the load balancer) Add a SQL Alias to the new SQL serve...

How to set up a SQL Alias for MS SQL Server 2008 R2 (for use with SharePoint 2010)

Image
To setup a SQL Alias, go to c:\windows\system32\ and open Cliconfg.exe from each server including the MSSQL Server and add an alias.  Here you define the OLDSERVER as an alias that redirects to the NEWSERVER.  You will need to repeat this process using CliConfg.exe in the folder c:\windows\syswow64.  This is repetitive, I know, but it's easier to do them both than to debug why one app sees the new server and the other is trying to hit the old one. If you have the good fortune to set up a SharePoint Farm from scratch, you should start out using an alias.  It's good "SQL Hardening" practice, and allows you to easier switch to a new MS SQL Server. Convention says to start with "A-" to indicate that it's an alias, but why be conventional - few people catch on to that convention anyway. Last note: be sure Named Pipes is enabled.  Open the SQL Server Configuration Manager , unfold the node SQL Server Network Configuration and select Protocols for MS...

Obtaining your SharePoint 2010 Product Key from Production

I needed to get the product key from the currently installed Sharepoint 2010 (in production) Take the script below, save it as a .vbs file and run it from one of the farm machines (not the SQL box). I found this script at: http://blog.jamzarwebdesign.com.au/wp-content/uploads/2011/11/SharePoint-2010-License.txt '========================================================================= ' VBScript Source File ' ' AUTHOR: Stewart Brown ' COMPANY: Jamzar Web Design ' WEBSITE: blog.jamzarwebdesign.com.au ' DATE: 4/11/2011 ' COMMENT: Will display the SharePoint 2010 License Key. ' ' Found original code on internet but can't remember where I ' found it so I'm not sure who to thank. ' If you own this code and can prove it, then please leave a ' message on blog and once confirmed I will update this code. '========================================================================= const HKEY_LO...

A system restart from a previous installation or update is pending when installing SharePoint 2010

After installing the prerequisites for SharePoint 2010, I was unable to install SharePoint I tracked down the error to a registry key that was not clearing itself. The fix was to open regedit and find the following entry: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager Rename the “ PendingFileRenameOperations ” value to “ PendingFileRenameOperations2 “   That fixed it - no reboot required.

Configure Data Replication in SQL Server 2008 R2

Image
This is a useful process, and it might help with my SharePoint 2010 Migration project. It looks like it may need to be set up one database at a time though, which could make things more involved. Also worthy of note: you must connect via machinename (or alias) but not localhost. In my case the restore method triggered the HBSS system as a possible attack, so this method was abandoned for the moment.

Adventures in SharePoint

My adventures in SharePoint land.  SharePoint has taken me all over from when I picked it up in Columbus, Ohio. I've been in Kuwait for over a year, and now I'm in Afghanistan for nearly a year. The end goal is a lakeside resort I've been building in Ohio ( www.happylake.com )