Cannot reinstall Sharepoint

This blog post is from (but I couldn't figure out how to link to it!):

Can not reinstall SharePoint.
Ok, My clients SharePoint is dead. I have the database files but the SharePoint as I know it is dead. Under Add/Remove in Control panel I tried to run "Windows Small Business Server Setup" and run maintenance and reinstall or install the Intranet component. It fails. There are many other steps to take. I tried to used the maintenance wizard to install, it failed, I went back in, it said it was installed, so I uninstalled again and then reinstalled, it failed. I tried everything I could think of. I spent 6 hours trying to get SharePoint back onto the system.

I tried Microsoft KB 829114 "How to remove and how to install the Windows Small Business Server 2003 SharePoint Services 2.0 companyweb Web site"
(This involves stopping the services, deleting the SharePoint website and application pools in IIS, editing the registry removing MSDE instance of companyweb and removing the MSDE data). This also failed.

I threw caution to the wind and downloaded the Windows SharePoint Services 2 SP2 from the web. The version for Windows 2003 server (Non SBS). I installed it flawlessly. I then uninstalled it, again it went perfect. I then run the wizard for maintenance in Add/Remove "Windows Small Business Server Setup" and the Intranet installed first time. It shows you how valuable a gut feel can be sometimes.

Why did I have to reinstall Sharepoint ?
I removed the MSDE instance for Companyweb in Add/Remove in preparation to move the databases to SQL 2005 Workgroup edition. Due to other issues, we could not continue with the SQL 2005 install so we ended up with no Companyweb. We could not install SQL 2005 in a way that we needed for the upgrade as the workstation components (Management studio) etc would not install. The repair suggested is to run a "change" on the existing SQL 2005 instance in Add/Remove in control panel and restrospectively install the tools. This did not work for us in this situation. I have seen this previously. Backup Exec 12d includes SQL 2005 Express. It does not include the tools. If this is installed before you try andinstall SQL 2005 Workgroup, there seems to be no way to install the missing tools. I have tried uninstalling Backup Exec and SQL 2005, and then reinstalling but I can't seem to get the tools to install.

From Microsoft "You may be unable to install the Client Components when you update the SQL Server Desktop Engine instance to SQL Server 2005. This behavior may occur if this is not the first instance of SQL Server 2005 that is installed on the server and if you did not install the Client Components together with the first SQL Server 2005 instance. If this is the case, SQL Server Setup displays a message that states that the Client Components have already been installed."

In my case the error was sompthing like .. a newer version of the tools has previously been installed, please exit the installation and from the comand line perform an upgrade ..... Nothing I read on the internet seemed to work.

Take a look at this link

It then dawned on me. The SQL 2005 interface and Management tool runs across the network. I had the software installed on a secondary PC. I could use that one to manage and make the changes to this database as SQL 2005 had installed on this server, Just minus the tools. It worked like a dream.

SharePoint recovery ?
how can you recover SharePoint ?
You can do it from the flat files, if you have them (The Ldf and MDF files). You can do it from a stsadm backup or from your backup tool if it supports a SQL Agent. All are valid recovery methods.

If all you want is the document libraries, you could also mount the companyweb under "My Network places" as a Network place (http://companyweb) and simply copy the data out.
It might be helpful to backup C:\inetpub\companyweb (If you have modified it) and have an IIS metadatabase backup handy.

You can recover to the same server and same AD or a new server with the same server name. You do this using different methods. Look at this article for help.

I had the situation where I needed to do a recovery from the Ldf and MDF files into a fresj MSDE instance. I reinstalled the Intranet onto the same server and AD. I stopped the services, replaced the Ldf and MDF files with the backup and restarted the databases. I then was told (in Internet Explorer) it was a foreign database "The Web site that is referenced here is not in the configuration database". Here is how I fixed it.
Start the companyweb Web site
(Click Start, point to Administrative Tools, and then click Internet Information Services (IIS) Manager. In IIS Manager, expand server_name (local computer), and then expand Web Sites.Under Web Sites, right-click companyweb, and then click Start.

Now remove Windows SharePoint Services 2.0 from thr CompanyWeb intranet site.
(Click Start, point to Administrative Tools, and then click SharePoint Central Administration (http://localhost:8081). Under Virtual Server Configuration, click Configure virtual server settings. On the Virtual Server List page, click the virtual server that you want to configure. In this example, click the companyweb virtual server. Under Virtual Server Management on the Virtual Server Settings page, click Remove Windows SharePoint Services from Virtual Server. On the Remove Windows SharePoint Services from Virtual Server page, click Remove without deleting content databases.Click OK. You will receive the following error message.
"The virtual server that is referenced here is not in the configuration database "

Extend the CompanyWeb intranet site by using Windows SharePoint Services 2.0.
(Click Start, point to Administrative Tools, and then click SharePoint Central Administration (http://localhost:8081). On the Central Administration page under Virtual Server Configuration, click Extend or upgrade virtual server.On the Virtual Server List page, click the name of the virtual server to extend. In this case, click companyweb. On the Extend Virtual Server page under Provisioning Options, select Extend and map to another virtual server. Under Server Mapping, click companyweb.Under Application Pool, click Use an existing application pool, and then click DefaultAppPool (NT AUTHORITY\NETWORK SERVICE). Click OK.)

For further information look here

Web Part Error: This page has encountered a critical error
After restoring my site I had this error. You can also get it after installing .Net Framework 2.0. You may have to change the .Net Framework back to 1.1.4322 on the site or virtual directories. Please do as following:

1. Open the IIS management snap-in.
2. Go to the properties of companyweb.
3. Go to the ASP.NET tab.
4. On the ASP.NET version select the drop-down and change from the 2.0.50727 to 1.1.4322.
5. Apply and close out the properties.
6. Browse companyweb.

Run Company Web on ASP.Net 2
If you want to run companyweb on ASP.NET 2.0.50727 you will need to upgrade run the following SharePoint command:

stsadm.exe -o upgrade -forceupgrade -url http://companyweb

SBS server 2003 WSS2- Everyone can edit my Company web ?
I have a client whose companyweb seems to ignore the permisisons supplied. Anyone can edit the companyweb, move webparts around and delete items. Even those whom have no account linked to the MSDE instance and do not appear in the users list. It has a strange "log in" button floating where the "Modify Shared Page" should be on the right hand side. It turns out that the reason is someone has played in the AD. The "SBS SP Admins" group is set and used by Sharepoint to allow people to edit and play with Sharepoint. It is in the Active Directory and in this case, someone added "Domain Users" to the Membership. Removing the "Domain Users" fixed the problem.

My Sharepoint has all my data in it, it is my life....
... Then you should consider an additional backup for it. Use the commandline in a batch file
"C:\Program files\Common files\Microsoft shared\Web server extensions\60\Bin\STSADM.EXE" -o backup -url http://Companyweb -filename C:\Backup\companyweb -overwrite