Month: May 2012

Get and Change Custom 404 Page in SharePoint 2010 Web Application

Yes it’s true, the 404 page is still alive and kicking.  And in SharePoint there sometimes comes a time when you just need to change that 404 up a bit. So first steps make sure you’re place you modifed 404 page into your 14 HIVE\templates\layouts\LangID folder (english is 1033). There should already be a file in there called Custom404.html. You can copy modify and rename it something like SuperAwesomeCustom404.html C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\LangID If you have multiple WFE’s you’re probably going to need this file put on each one of them. Then fire up Powershell and run the powershell code below. $webapp =Get-SPWebApplication http://sharePoint2010site $webapp.FileNotFoundPage = “SuperAwesomeCustom404.html” $webapp.update() And there a go. There’s more you can do with custom 404 pages than just kitty cats, and construction workers on a jackhammer. Maybe one themed out to look exactly like your site, with some text that makes sense such as. “Oh hey, looks like you’re gone as far as the web will let you go. Looks like there’s nothing here. Please turn around and continue your journey”. ​...

Read More

Get a list of all documents and items in document libraries with Powershell

I was tasked with finding a way to programatically traverse all the document lbraries in a site collection and ​return the documents as well as some specific information about it. I knew that I could put that together really quickly using the Get-SPSite cmdlet. And as soon as I got ready to open Powershell I remembered that this was a SP2007 machine. 🙁 All my super fast solutions went out the door as I realized m Get-SPSite cmdlt and others were not going to be available. Well I knew I could probably do the same thing, but I’d have to pull out the glue and duct tape to build it without my precious Sp2010 Powershell cmdlts. Before I turned back time and recreated the wheel I figured I’d take a quick look online and see if some one had previously dealt with this same situation but on a SP2007 scale, and sure enough one of my favorite SharePoint Automation guys Gary Lapointe had a blog post about it. (Short intermission, if you have twitter and aren’t following Gary Lapointe @glapointe I’d highly encourage you to do so, as well as often frequent his blog Sharepoint Automationhttp://blog.falchionconsulting.com/ His post stepped out how to build a function that actually runs against the entire farm and traverses all the document libraries on every site, web, under every web application in the farm. Well that was a little bit more than I needed but I was able to modify the script a bit...

Read More

OneNote 2010 Error – OneNote cannot create a new notebook at:

Ran into a really odd issue where a customer was trying to create a new OneNote 2010 notebook in SharePoint 2007. Everytime he tried to create the notebook in a document library he’s get the error below. I could reproduce the issue on my machine as well. After checkin Document library permissions and about a hundred other items I decided to do some real digging and realized that the​ OneNote 2010 uses WebDav to communicate with SharePoint. First thing I checked was the WebDav Client on my local machine and wouldn’t you know it, service was stopped. So I kicked on that server and Viola….err still broken. Perhaps server related was my next thought. I took a look at the Web Service Extensions in IIS on the server, and sure enough. Web Dav was “Prohibited” in IIS under the Web Service Extensions. So after looking around to make sure no one saw me enable it in PRODUCTION, kidding…. Always test what it’s gonna break in a dev environment first. Anyways I verified that I was having the same issue in Dev, then Set WebDav to “Allowed” in IIS, and was able to create and sync my new workbook with no issues. So lesson learned, OneNote 2010 and SharePoint need WebDav Allowed in IIS on the SharePoint Servers, as well as the webdav client running on the local machine. (BTW the WebDav client in winxp is a service called...

Read More

$ErrorActionPreference Variable

Let’s say you have a powershell script that you’ve developed and it requires some runtime variable, or specific snapins, and you want to make certain that your script doesn’t skip line 20 if line 15 has a null value for a variable etc… You can actually add the parameter ​$ErrorActionPreference = “” to your code. The Parameter can except 4 difference values which are: Continue (this is the default value and what you get if you don’t include this parameter in your script at all) SilentlyContinue Inquire Stop In my scenario I was working with a custom script and everytime it’d try to load a powershell snap in that was already loaded in my profile, the entire script would die, because my parameter was set as this. $ErrorActionPreference = “Stop” I quickly modified it to $ErrorActionPreference = “Inquire” This way I could see what things it was erroring on, and choose to Halt, or continue on with the script. A great blog post to follow is here http://tasteofpowershell.blogspot.com/2008/07/handling-errors-in-powershell.html...

Read More

The process cannot access the file because it is being used by another process.

Today I was deploying a solution to a web application and got the error message The process cannot access the file ‘MySolutionsName.dll’ because it is being used by another process.” After first giving the normal “What the What?” I checked the solution store and noticed the solution was in Error, and had the same error message listed. Looked like there was some issues with the solution file earlier during the day, either someone deploying it or retracting or maybe both. So after scratching my head and deciding that Uninstalling SharePoint wasn’t going to be a good option (just kidding btw), a quick google pointed me to an article below. Referencing a similar issue and giving a quick step on how to figure ou what process is holding your DLL hostage.  So I followed the steps; opened up a command prompt and typing in tasklist /M mysolutionheldhostage.dll(replacing the dll name with the name of my DLL). and it returned a list that a powershell process had a hold of my dll. So I opened up task manager, and sure enough a developer was doing something or the other to my dll in powershell. Next steps you could do would be KILLING THE PROCESS, or you could take a much gentler approach like contacting the offending user and asking them if they could close the app. WARNING, “Killing a task by force through the task list...

Read More