How to delete a sharepoint web application using stsadm tool? - sharepoint

Is there a command to delete the entire web application (database, iis sites etc) using the Sharepoint admin tool?
I know the same can be done in the central admin, but i have a need to automate this process as we want our build servers to rebuild the sharepoint site from scratch each night.

You should be able to do that with the stsadm unextendvs operation.
stsadm -o unextendvs -url http://MySite -deletecontent -deleteiissites

In addition to the unextendvs stsadm command you will need to drop the table in SQL. Using this command to remove the content database will remove the link from the content database to the SharePoint web application, but I don't think it will actually drop the SQL table.
So if you are running this every night be sure to either re-use the same content database or also script the table drop to ensure your SQL environment does not end up with abandoned tables.

Related

Setup Sharepoint site from one machine to another machine

Is there any fullproof and complete way to setup a sharepoint site from one machine to another machine with everything. Assume both machine have installed sharepoint server.
Create a Backup of your site collection using backup command in power shell or using central Admin. Restore the backup using restore Command Power Shell.

BackUp and Restore WebApplication to Newly Created WebApplication

I need to create clone for particular web application on my MOSS server. I have taken full backup for my existing web application from
Central Administration > Operations > Perform a Backup. I just want to know how can I use this backup file and restore it on newly created web application.
Please note that my webapplication has more than 10 different site collections.
Thanks,
Ashish Chotalia
best way to do this is using the Backup/Restore feature in Sharepoint Designer as described on this site.
You can use Backup/Restore to move a site as well.
If you use Infopath forms on your site, carefully check where the forms are stored after moving the site. It can happen that they point to the "old" lists or databases.

Copy SharePoint 2010 site collection/web application

I have a SharePoint 2010 web application with one site collection. I want to copy that site collection to a new web application on the same server.
I took a backup and restored it to a new database on the sql server. I then created a new web application with a temporary content database that I removed from the web application. I then added the restored copy of the original web app to the new web application.
The problem is the newly attached content database show 0 site collections, but there is in fact 1 single site.
I guess it has something to do with the id's? I have tried adding the content db both with and without assigning a new ID to the database.
Any idea how one can copy a site collection to a new web application on the same server?
--
Christian
Try using import/export. The main difference between import/export and backup/restore is that import/export generates new Guids.
http://technet.microsoft.com/en-us/library/ee428301.aspx
Use Windows PowerShell to export a site, list, or document library in SharePoint Server
You can use Windows PowerShell to export a site, list, or document library manually or as part of a script that can be run at scheduled intervals.
To export a site, list or document library by using Windows PowerShell
Verify that you meet the following minimum requirements: See Add-SPShellAdmin.
On the Start menu, click All Programs.
Click Microsoft SharePoint 2010 Products.
Click SharePoint 2010 Management Shell.
At the Windows PowerShell command prompt, type the following command:

How to migrate the data between two SharePoint Farms?

I want to perform the data migration between two SharePoint farms located on the same active directory. I don't know on how to migrate the data from one SharePoint from to another new SharePoint Farm
Several ways of doing this:
1) Backup content database on source farm and restore in target farm, then attach to a web application.
2) Create (i.e. export) a content migration package on the source farm and import on the target farm
3) Set up a content deployment path between the source and target farms (probably not appropriate in this case)
All of these are documented extensively on Technet. If you have custom or third-party code you will need to deploy these to the target server also.
The fundamental processes will be like this:
Create a new web application in your new WSS server.
Follow the instructions in Move content databases between instances of SQL Server.
However you may not be able to perform all of the steps exactly as written if your previous server farm is not available. The main thing is that you get the most recent backup of the databases restored on your SQL Server, then follow these steps from the linked article:
In Central Administration, on the Application Management page, in the SharePoint Web Application Management section, click Content databases.
On the Manage Content Databases page, click Add a content database.
On the Add Content Database page, type the exact name of the transferred content database, and then click OK.
Repeat steps 14 and 15 for each database you are adding. Be sure that you select the correct Web application from the Web Application menu for each database.
I don't know your farm topology but if you are sharing the same SQL Server used for the dead server farm, make sure that the dead farm is completely powered off. You don't want two different SharePoint farms accessing the same data (especially if one is in an inconsistent state).
If the old farm is alive and not in inconsistent state then you will be better off using a migration tool even if the versions of new and old are same.
The reason is that service packs, patches as well as order of their installation causes differences in SharePoint instances which can mess backup-recovery mechanism.
Migration is much more forgiving as it pre-assumes that differences exist between source and destination.
Several migration tools are available with Sharegate being my favourite.

How can I create a 'maintenance mode' for SharePoint?

I need to disable access to a SharePoint application between 6 PM and 7 AM. SharePoint 2007 doesn't seem to have an out-of-the-box "maintenance mode," so I'm looking for a solution. Presently someone moves users out of a security group to limit access to the application, so in the very least, automating that process would work.
Is there a PowerShell script or SharePoint feature or something I can add to my server to enable a maintenance mode for an application? Perhaps sample code for an SPJobDefinition?
you could automate the removal of users in a bat file with the
stsadm -o userrole -url <url> -userlogin <DOMAIN\name> -role <role name> [-add] [-delete]
Check out this link for a way to enumerate sharepoint with Powershell:
link
An IIS method is to restrict access by IP address. I've used that before successfully and it should be quite easy to write a PowerShell script to do it or use the IIS admin scripts.
I'm not aware of SharePoint methods that do this. There is the quiescefarm stsadm command but that applies to InfoPath forms only.
If you want to make the site completely inaccessible, you could write a script to add an app_offline.htm file to the SharePoint site's root directory.
This would prevent anybody from accessing the site, so it might not be ideal if you need to allow admins to login. But it might be a solution if you have a backdoor.

Resources