I have heard that it is a best practice to maintain a QA environment for SharePoint. I would like to script a nightly restore from our production SharePoint 2013 farm, which I'm successfully backing up with
I have a working PowerShell script that includes, in a nutshell,
Restore-SPFarm -Directory $backupdir -RestoreMethod New -NewDatabaseServer $qadbserver ` -FarmCredentials $farmcred ` -Item 'Farm\Microsoft SharePoint Foundation Web Application' -Confirm:$false
It works, but the problem is that it pauses prompts interactively for all sorts of additional details. For example,
PS C:\Windows\system32> C:\MY_MOSS\Backup_restore\restore.ps1 Loading C:\MY_MOSS\Backup_restore\common.ps1 Change location/name for: Farm\Microsoft SharePoint Foundation Web Application\SharePoint - 80 New web application name: (default: SharePoint - 80):
So how can I schedule it? There aren't any additional documented options to Restore-SPFarm to answer the additional questions. I'm pretty new to PowerShell. Is there a best-practice way of somehow piping answers to interactive prompts?
In response to Falak Mahmood's questions, here is a screenshot of what happens when I run it with
It is trying to prompt, to ask me further questions for confirmation, or in the case of
-RestoreMethod Overwrite, which is what I really need to restore the prod backups into the QA environment, it is asking for a whole bunch of new app and database names and other questions.
I will try to post a screenshot of that interactive conversation tomorrow. I don't think this is going to be possible with Powershell + MOSS 2013 + Restore-SPFarm OotB. Maybe I can automate a smaller restore, like all the individual site collections.