SharePoint - automatic scheduling of sharepoint 2010 backup
Asked By Jayanarayan
08-Sep-10 04:50 AM
hi friends
does anyone know how to take automatic backup of sharepoint 2010 using power shell scripts?? i have created a power shell script by copying the backup command. then call this script inside a batch file. put this batch file into windows scheduler which will do the desired job. i need the exact steps. i studied in internet that it is possible. but he has not given any steps. please help me. also when i run a batch file i dont see the output on screen. how to display the output on screen?? if anyone knows the solution please let me know.
Anand Malli replied to Jayanarayan

hi jaynarayan,
Step 1: Create a .ps1 file
To run a .ps1 script from the task scheduler, you must pass it as a parameter to powershell.exe.
- Run Notepad.
- Type or paste the following script into a blank document:
- Windows PowerShell
- Backup-SPSite
Backup-SPSite -Identity <SPSitePipeBind> -Path <String> [-AssignmentCollection<SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-Force <SwitchParameter>] [-NoSiteLock <SwitchParameter>] [-UseSqlSnapshot <SwitchParameter>] [-WhatIf [<SwitchParameter>]][<CommonParameters>]
- Save the file as AutoBackup.ps1. Be sure to select All Files under Save as type.
- By default, the file should be saved in your user profile folder (for example, C:\Users\myLogon\AutoBackup.ps1).
- To verify that the script works:
- Run an elevated PowerShell window.
- Type the location of the script. For example: C:\Users\myLogon\AutoBackup.ps1
Step 2: Create a task in Windows Task Scheduler
The following procedure describes how to create a task on the head node that runs the AutoBackup.ps1 script every day at 6:00 AM.
To create a task in Windows Task Scheduler that runs AutoBackup.ps1 every day
- Log on to the head node as a user with administrative permission.
- Click Start, point to Administrative Tools, then click Task Scheduler.
- If the User Account Control dialog box appears, confirm that the action it displays is what you want, and then click Continue.
- In Task Scheduler, in Actions, click Create Task. The Create Task dialog box appears.
- In the General tab:
- In Name, type: AutoBackup
- Select the Run whether user is logged on or not radio button.
- Select the Run with highest privileges check box.
- In the Trigger tab:
- Click New. The New Trigger dialog box appears.
- Select the Daily radio button.
- Set the start time to 6:00 AM.
- Click OK.
- In the Actions tab:
- Click New. The New Action dialog box appears.
- In Settings, in Program/Script, type:
- powershell.exe
- In Add arguments, type the following, where C:\Users\myLogon\AutoBackup.ps1 is the location of the script that you want to run:
- -command “C:\Users\myLogon\AutoBackup.ps1”
- Click OK.
- In the Create Task dialog box, click OK. When prompted, enter your password.
- Verify that the new task works:
- In Task Scheduler, in the navigation pane, select Task Scheduler Library.
- In the view pane, right-click AutoBackup, then click Run.
I hope u got all the steps required...
cheerssss...:)
Jayanarayan replied to Anand Malli
thank you very much Daivagna
i will try it and let you know.
Jayanarayan replied to Anand Malli
thank you very much Daivagna
i will try it and let you know. also how to know the output of that batch file. pls indicate failure or success after the batch file is executed. it will be easy to find out in future.
Jayanarayan replied to Anand Malli
hi deivagna
i tried your script . the task says completed successfully. but when i goto backup folder i don't see any backup folders. pls help me
jayanarayan
Anand Malli replied to Jayanarayan
Hi Jayanarayan
append following code snippet @ the end of your powershell script file.
trap [System.Exception]
{
return $("Error: " + $_.Exception.Message);
}
it will catch if any exception is being raised & display the message on the script..
I hope it will solve your query for success or failure....
Jayanarayan replied to Anand Malli
ok. but the backup files and folders are not present. what to do for that?
sunardareswar replied to Jayanarayan
Hi Sir,
The script for the Automatic Scheduling is working for me.But can u Tell me how can i restore that back up file again into my new web Application
With Regards,
Annaji.Mantha
bharath radhekrishna replied to Jayanarayan
Hi Jayanarayan,
To work Open the scheduler with administrator privileges.
bye
Jayanarayan replied to Jayanarayan
hi
you can similarly create the restore script and put in task scheduler. it will automatically restore to the corresponding location.

w3wp.exe process error SharePoint When trying to extent a web application, or modify authentication settings, of a particular web application in our MOSS 2007 environment, I get the following error: "An update conflict has occurred, and you must re-try this action. The object SPWebApplication Name = [SharePoint Web App] Parent = SPWebService is being updated by domain \ username, in the w3wp process, on lines were generated: 04 / 20 / 2007 11:24:18.84 w3wp.exe (0x1608) 0x0330 Windows SharePoint Services Topology 75bd High UpdatedConcurrencyException: The object SPWebApplication Name = BlueNet Parent = SPWebService was updated by Determine if these changes will conflict, resolve any differences, and reapply the second change. This error may also indicate a programming error caused by obtaining two copies of the same object in a single thread. Previous update 24:18.6117 04 / 20 / 2007 11:24:18.84 w3wp.exe (0x1608) 0x0330 Windows SharePoint Services Topology 8xqy High ConcurrencyException: Old Version : 36145 New Version : 0 If anyone has any
Failed to register SharePoint services error SharePoint Can anyone provide direction on how to tackle this error. I receive this error while configuring SharePoint 2007. SharePoint Portal Server Dev Discussions IIS (1) SharePoint (1) Database (1) Foundry, Please troubleshoot along the following lines. 1. Please make sure that
Sharepoint Site Upload Error SharePoint My managers and I use a sharepoint site which I created and have full control of. I have verified that I am upload documents. When any of us attempt to upload a document we receive the following error message: Go back to site Error Additions to this Web site have been blocked. Please contact the administrator to resolve this problem. Troubleshoot issues with Windows SharePoint Services. Would appreciate your suggestions SharePoint Discussions Windows SharePoint Services (1) SQL Server (1) SharePoint (1) IIS (1) DBCreator (1) PowerUsers
How do I automate document uploads to SharePoint? SharePoint I'm wanting to use a batch file or code in MS access to copy files from a shared directory into my sharePoint documents folder. I can't seem to get this to work b / c it is a web folder and not a normal network share. Any ideass? SharePoint Design Discussions SharePoint (1) I am not sure what diificulties you are running into because you can map a drive letter to a sharepoint site without any issues. Perhaps if you posted the error message we can help. There is a tool out there call DavCopy that allows you to copy files to sharepoint. Check it out: http: / / www.bluedoglimited.com / Downloads / pages / DavCopy.aspx Well, This apparently has
Drag an inbox email into a Sharepoint Doc Library visible in Outlook Folder List under "Sharepoint Lists" SharePoint If I connect a Sharepoint doc library to Outlook, the library appears in my Outlook Folders list like this: Sharepoint Lists \ Sharepoint Library Name (files in that Sharepoint LIbrary appear here) (Subfoldes in that Sharepoint Library appear here) If I then select an email from my inbox, and drag it