Sharepoint Automated Backup Restore Process Verification

Hi All,

I automated the following powershell backup in a scheduled task we are running Sharepoint foundation 2010. - Here is the script. - This is how i setup the scheduled task to run this.

In the backupdir location I am getting a folder with 10 or 20 bak files.

This is the last lines of the SPBACKUP.LOG

[25/03/2015 16:10:01] Finished with 0 warnings.
[25/03/2015 16:10:01] Finished with 0 errors.
[25/03/2015 16:10:01] Backup completed successfully.
[25/03/2015 16:10:01] -------------------------------------------------

Questions I have.
1. How do i restore all of these bak files?
2. How do i verify this is a good backup?

EDIT - I have looked in the backup directory I have one folder and one xml file, within the folder there are 29 files 27 are bak files. The total size of this folder is 225KB which makes me think something is wrong here.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Walter CurtisSharePoint AEDCommented:
You do not need to individually restore each file. Use the restore cmdlet and just reference the first file name, and the others are included automatically.
wannabecraigAuthor Commented:
Hi Sneekco,

Are you farmiliar with this script?

Does it sound like it is working correctly?

Is there any way I can verify the backup is working correctly?

If I do a backup manually from Sharepoint Central Admin the outputted file is 20MB in size so I do not see how this backup is actually working properly.

Thanks for the quick response.
Walter CurtisSharePoint AEDCommented:
Yes, something does not sound correct. Check the size again. You will get a successful message, but the backup continues to run and the size of the folder will increase. Depending upon the size of the farm, the folder will grow until the process is actually finished.
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

wannabecraigAuthor Commented:
Does the account running this task require access within SQL over the instance?

In the Requirements it doesnt seem to say it requires anything but add-spshelladmin which I have granted.

I get these errors in the logs.

[25/03/2015 16:41:47] Verbose: [SharePoint_AdminContent_e3cc9a71-bb73-4815-8096-29f9f490fb42] SQL Server Connection String: Data Source=SERVERNAME(edit)\Sharepoint;Initial Catalog=SharePoint_AdminContent_e3cc9a71-bb73-4815-8096-29f9f490fb42;Integrated Security=True;Enlist=False;Connect Timeout=15.
[25/03/2015 16:41:47] Verbose: [SharePoint_AdminContent_e3cc9a71-bb73-4815-8096-29f9f490fb42] SQL command started at: 25/03/2015 16:41:47. This command may take a while to complete and without notification.
[25/03/2015 16:41:47] Verbose: [SharePoint_AdminContent_e3cc9a71-bb73-4815-8096-29f9f490fb42] SQL Server Command: BACKUP DATABASE [SharePoint_AdminContent_e3cc9a71-bb73-4815-8096-29f9f490fb42] TO DISK=@db_loc WITH NAME=@db_name, STATS=5, NOINIT, NOSKIP, NOFORMAT, NOREWIND
      @db_name=SharePoint_AdminContent_e3cc9a71-bb73-4815-8096-29f9f490fb42, @db_loc=\\backupdir$(edit)\spbr0000\00000043.bak
[25/03/2015 16:41:47] Verbose: [SharePoint_AdminContent_e3cc9a71-bb73-4815-8096-29f9f490fb42] SQL command timeout is set to 1.00 hours.
[25/03/2015 16:41:47] Warning: [SharePoint_AdminContent_e3cc9a71-bb73-4815-8096-29f9f490fb42] Cannot open backup device '\\backupdir$(edit)\spbr0000\00000043.bak'. Operating system error 5(failed to retrieve text for this error. Reason: 15105).
BACKUP DATABASE is terminating abnormally.
wannabecraigAuthor Commented:
Here are the requirements for this script. We are on Sharepoint Foundation 2010  

Included below is an entry in the windows app log event viewer.

 REQUIRED: the account serving as the identity of the Scheduled Task must have the  
 following permissons on that server:
  - WSS or MOSS:  
      - DB_CREATOR and SECURITYADMIN roles in the SQL instance hosting  
        the farm's SharePoint databases
      - local administrator rights on the server
      - DB_OWNER rights on the farm's SharePoint databases
      - Read, Write, and Update rights in the shared directory where backups  
        are created
  - SharePoint Foundation 2010 or SharePoint Server 2010
      - It must be granted the SHAREPOINT_SHELL_ACCESS role via the  
        Add-SPShellAdmin CMDLET - DONE
      - Full Control of the shared directory where backups are created - DONE
      - The account that runs the SharePoint 2010 Timer Job (SPTimerV4.exe) service,
        and the SQL Server instance's SQL Service account must have Full Control
        of the shared backup storage directory - THis was not done Network Service was not added but now is.

Update - Checked the windows app log filled with errors like this Log Name:      Application
Date:          25/03/2015 16:52:50
Event ID:      3041
Task Category: Backup
Level:         Error
Keywords:      Classic
BACKUP failed to complete the command BACKUP DATABASE SharePoint_AdminContent_e3cc9a71-bb73-4815-8096-29f9f490fb42. Check the backup application log for detailed messages.
Event Xml:
<Event xmlns="">
    <Provider Name="MSSQL$SHAREPOINT" />
    <EventID Qualifiers="49152">3041</EventID>
    <TimeCreated SystemTime="2015-03-25T16:52:50.000000000Z" />
    <Security UserID="S-1-5-21-1728536662-146330824-3268609631-2660" />
    <Data>BACKUP DATABASE SharePoint_AdminContent_e3cc9a71-bb73-4815-8096-29f9f490fb42</Data>
Walter CurtisSharePoint AEDCommented:
You are receiving an access denied error. In the scheduled task manager you can set which account the task should run as. That would be the access with access to the database.
wannabecraigAuthor Commented:
Do we need to grant privileges within SQL and to that SQL instance for the account that runs the task?

Presently it does not have any SQL access.
Walter CurtisSharePoint AEDCommented:
The account that runs the task needs to have the permissions you describe in your comment from above.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wannabecraigAuthor Commented:
Cheers will give it a shot.
wannabecraigAuthor Commented:
Ok working now with the permissions one of the reasons I hadn't added them is in the requirements above it looks like its asking to add them only in WSS or MOSS which we are not using. Its actually asking to add all in 2010 Foundation too.

Im backing up 500MB roughly now with no errors in the logs so im happy enough with this now.

Thanks Sneekco
Walter CurtisSharePoint AEDCommented:
Glad that is working for you.

Have fun!
wannabecraigAuthor Commented:
The issue fyi was caused by 2 things.

1. No SQL access on DB.
2. This access denied error was a windows permissions error on the output dir.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Storage Software

From novice to tech pro — start learning today.