Locking MOSS or WSS

Server or site migrations require that you give yourself ample time for the transition.  The last thing you want is for users to be making changes on the site while you are taking a backup and moving to another location.  There are many ways to avoid this server-side that will interrupt the users viewing experience.  But, there is one way that you can still allow the users to interact with the MOSS or WSS site without allowing them to add/update/delete content.  By using the site lock feature you can switch an entire site collection to read-only mode.

stsadm –o setsitelock –url http://server/site –lock { none | noadditions | readonly | noaccess }

none = sets site to “normal” mode allowing adds/edits/deletes

noadditions = no additional content can be added, current content can be edited as long as it doesn’t add to the total content

readonly = entire site becomes readonly.  No adds/updates/deletes are permitted

noaccess = locks total access from the site.  User will see an error specifying that they contact the administrator for more information

Failure Decompressing Data from a Cabinet File

The MOSS/WSS GUI is great for many of the day-to-day administrative tasks, but I have found that it falls short on many of the larger tasks such as migrating entire sites or even large lists.  Using the STSADM command line tool with the correct parameters can solve errors like the one in the title of this entry.

stsadm -o export -url http://server/site -includeusersecurity –nofilecompression -filename C:\directory
stsadm -o import -url http://server/site -includeusersecurity -nofilecompression -filename C:\directory

-includeusersecurity = will add ALL of the user accounts that have posted, edited, or have been given direct access to the site.  This can either be a great help or a major pain.  If the site and lists on the site rely heavily on tracking who created/modified files in document libraries, or you have workflows that use people pickers or utilize the createdby or modifiedby fields this should be included.

-nofilecompression = makes the export larger, but does not throw the failure decompressing error.  Using this flag also requires that you use the command line tool to import.

If either of these flags are included on the export, they will also need to be included on the import.

Another Custom Form Issue

After making a few changes to a custom form “NewForm_2.aspx” in WSS I realized that I needed to start over.  I deleted the form and copied “NewForm.aspx” again and renamed to “NewForm_2.aspx”.  When doing this you need to point WSS to the new form by using SharePoint Designer, right clicking the list, then using the “Supporting Files” tab browse to the newly created custom form:

image

image

The issue was when I deleted “NewForm_2.aspx” I broke the hook that WSS had to the form.  Even recreating the form did not reset the hook.  When clicking the “New” button on the list I got the error “Invalid Page URL:”.  Microsoft has a KB article on this:

http://support.microsoft.com/kb/935504

But that does not resolve the issue.  It states “To resolve this issue, delete the list, and then re-create it.”. This was not an option with a list with over 400 items and 50+ fields.  So I went on the hunt and finally found this article:

http://blogs.msdn.com/dszabo/archive/2007/02/20/custom-list-newform-aspx-ruined-in-wss-3-0.aspx

In the article they explain the issue and a few ways to resolve it without deleting the list and recreating.  The option that I found that worked was in the “POST-POST COMMENT: ALTERNATIVE RESOLUTION” section.  Here you just need to replace a piece of the HTML code used by WSS to build the page.  It worked like a charm!

SharePoint Custom Form Issue

A few days ago my boss and I were on a 4.5 hour call trying to fix a SharePoint custom list that had started behaving strange after a migration from MOSS to WSS.  The creator of the list customized the “NewForm.aspx” and named it “NewForm_2.aspx”.  The issue was a single column that was not saving when a new item was created, but could be edited and it would save fine.   It was a lookup column to a list on the same site that had about 25 items.

First, we recreated the column with a new name & copied the data over then deleted the old column.  I refreshed and reordered the SharePoint custom data list on “NewForm_2.aspx”.  Still not saving…

Second, we recreated the lookup list.  Still not saving…

Third, we changed the column to a standard choice control and hard-coded the values from the lookup list into the choice field.  Still no luck…

I would go into all that we did, but it might take a few hours to list… so after “NewForm_7.aspx” was created (2,3,4,5,6 failed) I decided to not rearrange the fields on the form, leave them as they were default.  It worked!  So I reordered the columns in the list settings and created “NewForm_8.aspx”.  All is good now.

Lesson of this story: When creating custom forms in SharePoint.  #1 do not delete the placeholder where the data control is.  #2 Do not move fields on the form.  Removing fields is OK, but once they are moved you get unpredictable results.  Use the list settings to reorder the columns how you want THEN create the form.

SQL Move TempDB

I always forget the code to do this because I do it so rarely.  If you want to move the location of TempDB for SQL Server do this:

 USE master
GO
ALTER DATABASE
tempdb
MODIFY FILE (NAME = tempdev, FILENAME = '{new location}\tempdb.mdf')
GO
ALTER DATABASE
tempdb
MODIFY FILE (NAME = templog, FILENAME = '{new location}\templog.ldf')
GO


Then restart the SQL Server services.

Moving Windows Internal Database

Windows Internal Database (or SQL Server Embedded) can be used by WSS or Windows Software Update Services (WSUS).  It is well hidden and annoyingly unmanageable.  By default the data files reside in a folder under the root drive in the Windows directory.  This can be a bad place to allow a potentially fast growing database to reside… especially if your drives are partitioned for a small “C” drive just to be used by the operating system.  I was able to find out how to move these databases pretty easily.

1. Download and install SQL Server Management Studio Express (find it here: http://tiny.cc/msssmse)
2. Turn off any services that might be using the database (SharePoint, WSUS, etc)
3. Connect to \\.\pipe\mssql$microsoft##ssee\sql\query using SSMSE named pipes
4. Detach all databases that you wish to move (check box to kill connections)
5. Move the databases and associated log files (MDF & LDF) to the desired location
6. Reattach databases in there new location

Now the databases will not hog your boot drive.

Server Alias/Name Resolution WSS

An interesting but frustrating thing occurred a few months back when I was creating a SharePoint WSS server installation at work.  We had created an alias for the server but the name would not stick.  You could browse to the server but whenever you clicked a link within SharePoint it would take you to the page with the name of the server in the URL not the alias.  The same would happen when using the IP address, NetBIOS name, or the FQN. 

Solution… the Alternate Access Mappings link within SharePoint Central Administration.  Set up all the possible names that people may type into to get to a place within SharePoint and that name will stick.

Max List Template Size

In SharePoint (MOSS 2007 & WSS 3.0) there is a limit on the size of list template that can be saved… 10MB.  For most lists that just contain data this is sufficient.  There may be a need for lists that have attachments or document libraries that may contain many documents.  SharePoint lets you increase this size to a maximum of 500MB by running the following command at the prompt:

stsadm -o setproperty -propertyname max-template-document-size -propertyvalue 50000000

IIS Gone after MOSS 2007 Install

I noticed the other day that IIS management was not connecting shortly after an enterprise MOSS 2007 installation.  I know a few colleagues at work had mentioned seeing this before as well.  I went on the hunt and came across a well hidden paragraph in an article about IIS in general that gave me the solution.  Apparently all you need to do is stop and restart the SharePoint timer service.  That is it!  Amazing how simple the solution can be for an issue that has caused so many people to jump through hoops for workarounds!

SharePoint STSADM Helper

I ran across a great suite of tools offered for the STSADM command line SharePoint administration tool.  It is a helper class written by Gary LaPoint MOSS MVP.  Great features and nice documentation. 

Here is his blog: http://stsadm.blogspot.com/

And here are the tools: http://stsadm.blogspot.com/2009/02/downloads.html

Turn off Hibernate in Vista

Switching Hibernate on/off in Windows XP was easy, go to control panel then power options and the last tab gave you options for Hibernate.  IN Vista it is a different story… they removed the option altogether from the power setting dialogs.  If you are like me and do not use this feature open a command prompt and execute the following:

powercfg.exe /hibernate off



This will not only turn off Hibernation, but will also give you back anywhere from 2-4 GB of disk space.

SQL Pinhole for WSS/MOSS Installation

I am a big supporter of a multi-tiered environment when developing large applications especially in a corporate environment.  I don’t just mean having different class libraries for data access/business logic I mean true physical separation between the web server and the database server.  When I installed a quick sandbox site of WSS for work I just let the installation steps guide me through the installation.  Apparently with WSS 3.0 this creates an instance of Windows Internal Database.  This is even more stripped down than SQL Server Express edition I guess!  But, I was still able to connect to it using SSMS… so it wasn’t a total loss.

When creating the production environment I wanted to do it right.  I wanted SQL to run on our corporate DB server tuned for database activity and WSS to have a dedicated web box configured specifically for serving up web applications in ASP.Net.  A simple install proved that this was not easy… just specifying the database server on install was not enough, especially since this was not a default instance of SQL server but one of many.  I found a document buried in the MSDN library indicating that I needed to create a “Pinhole” for SQL to be seen by WSS.  Here is what I did:

First I needed to create a System DSN for the SQL server instance giving it simply the name of the server (no port number on it either):

image

Second on the next screen you will need to click the “Client Configuration…” button:

image 

Third you will need to add the port number of the instance created (make sure TCP/IP is selected):

image

If you are unsure of the port number an SQL instance is using you will need to open up SQL Configuration Utility and browse to the TCP/IP configuration window and look at the second tab bottom.  There are two fields for ports here “TCP Dynamic Port” and “TCP Port”.  The Dynamic port is the one you want unless you need to set your own port… if so change the “TCP Port” field and click OK… you will need to restart the SQL services for this to take hold.

When done setting the port click OK and step through the rest of the DNS configuration wizard.  Test the connection to make sure that it works.  Now all you will need to do in WSS is specify the server name exactly how you did on the first screen on the DSN wizard and all should be good!

WSS 3.0 Rebranding

I was recently given the task of rebranding our WSS production server at work to rid ourselves of the ugly WSS / MOSS header with the three peg-people they use.  This is a relatively easy task in MOSS but not so easy in WSS.  On the server in the folder “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\GLOBAL” there is a file “Default.master”.  If this file is edited it will impact ALL sub webs created under ALL site collections in WSS.  It will also impact existing sub webs.  Altering the “Application.master” file in the “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS” folder will rebrand the administration pages.  Be careful changing either of these as SharePoint is very picky about objects existing on the page when it loads the dynamic content.

If you want only to rebrand a singe site at a time you will need SharePoint Designer 2007.  If you browse to the site that you want to edit and look for the “Default.master” file in the masterpage directory and edit it SharePoint will create a ghosted copy of the file.  That site will show the changes, but not its children or any other sites created/existing.  To revert back just right click the edited file and choose “Reset to Site Definition”.

Disabling Themes WSS 3.0/MOSS 2007

If you have a need to tighten the visual standards on SharePoint WSS & MOSS you can easily disable the themes available to site owners so your site collection does not look like something out of Willy Wonka’s chocolate factory.  To do this simple use you favorite XML editing tool and open up the file “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033\SPTHEMES.XML” and comment out any of the theme blocks you do not want to show:

<?xml version="1.0" encoding="utf-8"?>
<!--
_lcid="1033" _version="12.0.4518" _dal="1" -->
<!--
_LocalBinding -->
<
SPThemes xmlns="http://tempuri.org/SPThemes.xsd">
<
Templates>
<
TemplateID>none</TemplateID>
<
DisplayName>Default Theme</DisplayName>
<
Description>
The default theme has a white background with blue control
areas and orange highlights.
</Description>
<
Thumbnail>images/thnone.gif</Thumbnail>
<
Preview>images/thnone.gif</Preview>
</
Templates>
<!--
<Templates>
<TemplateID>classic</TemplateID>
<DisplayName>Classic</DisplayName>
<Description>
Classic has a white background with blue control areas
and orange highlights.
</Description>
<Thumbnail>images/thclassic.gif</Thumbnail>
<Preview>images/thclassic.gif</Preview>
</Templates>
-->
</
SPThemes>



Vista Parental Controls on a Domain?

After Vista has been joined to a domain you lose a few things like Parental Controls & some Media Center capabilities unless you manually re-enable them.  To do this for the Parental Controls go to group policy editor (start > run > gpedit.msc), then to Computer Configuration > Administrative Templates > Windows Components > Parental Controls.  Enable the setting “Make Parental Controls control panel visible on a Domain”:

image

SSMS 2008 Not Allowing Changes

By default SQL Server Management Studio does not allow changes to be made to tables if they need to be dropped and recreated.  This is frustrating in a development environment since changes are made quite often.  Again, Microsoft enables a feature to protect a production environment and does not make a fix for it well known.  Here is the error you will receive:

image

Here is the fix… go to “Tools > Options”:

image

Then expand “Designers” then click on “Table and Database Designers”.  Uncheck the box next to “Prevent saving changes that require table re-creation”:

image

SSMS 2008 Connecting to SQL 2005

When trying to connect to a SQL 2005/2000 Server from SQL Server Management Studio 2008 you will get this error when trying to view the list of databases:

image

There is a very quick way to resolved this.  Click on the “View” menu and select “Object Explorer Details”:

image

Right click the column header and deselect “Collation”:

image

Now refresh the database list and all should be good.

Changing Domains with Vista & Win 7

When a primary domain controller goes down and you do not have a BDC or a system state backup there is not a lot you can do to bring active directory & DNS back online cleanly.  I searched and searched for a solution but found nothing.  So I learned my lesson, always do a system state backup when completed with DC setup AND backup at regular intervals to ensure an easy recovery.

But since I did not do that, I had to go about it the hard way… reinstall DC and disjoin PC’s from old domain then join PC’s back into the newly set up domain.  The trouble with that is keeping the user profiles active on the local machine without disrupting their settings & customizations.  And I also don’t want user folders called c:\users\[DomainName].[UserName]… I just want c:\users\[UserName] to keep it clean.  Luckily there are a few quick tools that Vista/Windows 7 provides to assist with that.

First there is the Windows Easy Transfer tool.  Great tool for getting all of your desktop settings, Outlook accounts, background images, and you can customize the files you transfer.  The wizard is very simple and allows for backup to disk, DVD, or external drive.  Because I was not moving to another PC and I was not reinstalling the OS on these machines, I just backed up to a local folder.

image

Second I needed to log into the local machine administrator account and remove the user & their profile.  A full restart will ensure that there is no locked files for this step.  To remove the user go to Control Panel > User Accounts, then click Manage User Accounts.  You can see a list of the users both local and domain here:

image

Click the user you want to remove, then click Remove.  This only deletes the account, now we needed to delete the profile from the local computer.  Go to Control Panel > System > Advanced System Settings > Advanced [TAB] > User Profiles section.  Click Settings.  Click the user you want to delete the profile, click Delete.

image

Just to verify that the user profile directory was deleted go to C:\Users\.  Delete the folder if left behind (typically only happens if a restart was not done after the first step).

Now you can rejoin the domain, add the user, and restore the settings using the same Windows Easy Transfer tool used before.  With the exception of passwords not being saved (for very good reason) the user will have little or no impact.

Server 2008 Activation DNS Error

Last night I was finishing up with the installation of 2 servers (PDC & BDC).  After completing all of the updates and configurations I needed to activate the product… DNS Error!  After doing a little searching I found the KB article from Microsoft (KB929826) which states that with volume licenses or multi-activation keys you may need to run this first at the command prompt:

slmgr –ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx

[xxxxx-xxxxx-xxxxx-xxxxx-xxxxx is the product key]

Then you should have no problem activating.  Nice to know for the future!

Leapster 2… broken?

I am glad to say no.  But it had us a little upset earlier.  About 10 months ago we replaced our sons Leapster LMAX with a new Leapster 2 (see link: Leap Frog Site).  He plays with this learning toy non-stop.  The other day he told us it was broken… turns out he dropped it on the carpet and it just stopped working.  A kids toy should not break when dropped on the carpet… oh well.  Anyway, after calling the Leap Frog support number I found that not only was it out of warranty but it was also not covered because it was dropped.  So I took it apart… DOH!

Here is what I found… it would turn on if a jiggled it a little and held it still.  As soon as I moved it or squeezed it at all it would turn off.  Something loose right?  I looked at it and saw nothing loose… but then it hit me that when I pressed on the battery cover it would turn off.  I checked that the terminals were in contact with the battery and they weren’t…  I bent them towards the battery and voila! … it works perfect.  Happy son, happy pocketbook.  :)

Picture 1 – Take off the 5 screws on the back…

IMG_0077

Picture 2 – Bend the battery contacts away from the edge (towards center)…

IMG_0076 

That’s it!  Just be careful with the ribbon cable that runs from the backing to the main board.

Style Issues with IE8

As with most web developers I am sure we get frustrated when Microsoft releases a new browser. When IE7 was released it was a style disaster until they released some updates that fixed the issue... now we are at it again with the release of IE8 earlier this year.

One of the most frustrating things that I have encountered while developing for IE8 is its inability to recognize certain CSS attributes. DIV's, SPAN's, and just about anything that you position absolute on the screen gets all tweaked. I did some searching and found a fix to IE8 Compatibility Viewit... force IE8 to run in IE7 compatibility mode instead of making the user click the compatibility icon next to the address bar. 

Add this line to the HEAD section in your HTML:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

I finally created a blog...

For a few years now many people have been telling me to start my own blog. I guess they think I have something good to say every now and then! Most of the stuff I blog about will probably be nerdy things like coding or gadgets... but some may find that interesting! At the very least I can document some of the things I do from day to day.