Backup Skype for Business On-Premise

This is a simple script to back up your Lync 2013 or Skype for Business (SfB) Standard or Enterprise Edition Server to a single zip.file. It does not only make a copy of your topology, but will make a backup of your IIS files, your SQL server databases and much more.This is rea

Backup-SfB.ps1
 
 
 
 
 
4.9 Star
(23)
5,344 times
Add to favorites
Lync
4/15/2017
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Support for SQL Mirror back end
    1 Posts | Last post October 06, 2017
    • Hi Lasse,
      
      I've noticed that your script only backs up the SQL backend databases from a mirror when they are principle on the primary server. The problem is in the way that the script determines the SQL server to backup from. For instance, for the CMS it uses (Get-CsConfigurationStoreLocation).BackEndServer which always returns the primary mirror server. If the databases are principle on the secondary, then the MirrorBackEndServer property should be used.
      
      Before I start looking in to a way to work round this, I wondered if you are aware of this or, better still, have plans to fix it?
      
      I guess there are three options:
      - Fail all of the databases to the primary before running your script (I prefer to keep an eye on this process).
      - Check where the databases are and include some logic in the script to use the appropriate property accordingly.
      - Attempt to backup from both primary and secondary so it doesn't matter where the databases are currently principle.
      
      Once again, thanks for the awesome script.
      
      Toby
      
  • Blank on Line 929
    1 Posts | Last post September 29, 2017
    • the mail couldn't be send. there is a blank on function call "send_email".
  • Error export configs
    1 Posts | Last post August 02, 2017
    • Hi Lasse,
      
      I got loads of errors like Export-Clixml : Could not find a part of the path
      I did some research, and the cleanup-run deleted the just created directories. The DatetoDelete was in the future, not in the past. I changed it in $DatetoDelete = $CurrentDate.AddDays(-$Days) (added the minus) and now it's working fine.
      
      Regards,
      
      Folkert
  • SendEmailOnCompletion
    3 Posts | Last post June 14, 2017
    • Hi Lasse,
      
      Thanks for developing this awesome script.
      
      I am not sure how to use the SendEmailOnCompletion parameter. When I use the switch I receive an error: Parameter set cannot be resolved using the specified named parameters.
      
      Can you please explain how this should be used?
      
      Best regards,
      
      Duncan
    • Seems there is missing a few lines of code in the script regarding the SendEmailOnCompletion
    • Hi Steffen,
      
      That's what I thought as well. Hope that Lasse will (re) enable this functionality in a future release.
  • Clean up of older backups in custom storebackupto path
    2 Posts | Last post May 20, 2017
    • Hi Lasse,
      
      Firstly, many thanks for you efforts on this script. It's excellent!
      
      I'm running version 4.2 and scheduling the script to run using the new -basic -user scenario parameters. I have also specified a custom -backupTo and -StoreBackupTo filepaths.
      
      I've noticed that the default delete older backups than 5 days does not remove the backups from the custom -storebackupto filepath/folder.
      
      I might be missing how to set this, or how to edit to resolve, but advice will be greatly appreciated, thanks in advance.
      
      
      
    • Thank you for bringing this to my attention,
      I think maybe I know where my coding went wrong, I'll make sure to investigate this in an upcoming release
      
      //Lasse
  • Exclusion of DfsrPrivate folder from file share backup
    5 Posts | Last post April 09, 2017
    • Hi Lasse,
      
      Thanks a million for the superb backup script.
      
      I came up against a problem where the file share backup was hanging while trying to backup a share based on DFS. The xcopy process hung while trying to backup the hidden system folder "DfsrPrivate". I excluded it from the copy by amending the script from line 234 and the script then proceeded as normal. I wonder if you've come across this before?
      
      Also, I decided to exclude the "WinFabDumpFiles" and "WinFabTraceFiles" folders as the "WinFabTraceFiles" in particular is quite large with over 10000 files and I don't think it would be a good idea to restore these files during a recovery. What do you think?
      
      Many thanks,
      
      Toby
    • Hi Toby!
      
      To be honest, the WinFabDumpFiles folders were quite small when I wrote the previous update to this script. I have seen the same as you, and I am quite positive these files are not required for a restore and can be skipped (just added to the to-do-list).
      
      I don't have a deployment with DFS shares available at the moment, but I take your word for it. I will look into it once I get my hands on a DFS deployment.
      
      KR,
      Lasse
    • Hi,
      I'm seeing a similar issue with the backup stalling when copying from our DFS fileshare.
      
      How did you exclude the the folder tobewah?
      "DfsrPrivate" | Out-File $excludeFile1 -Append ?
    • Hi Skakke,
      Depending on which option you are using, it could be any of the files used.
      I am working on an update, excluding the path by default.
      Here is the code I have prepared for the three files in use:
          $excludeFile1 = $env:temp + "\exclude.txt"
          #List of excluded directories from xopy
          "ABfiles" | Out-File $excludeFile1
          "DeviceUpdateStore" | Out-File $excludeFile1 -Append
          "Meeting.Active" | Out-File $excludeFile1 -Append
          "DfsrPrivate" | Out-File $excludeFile1 -Append
          $excludeFile2 = $env:temp + "\excludeabs.txt"
          #List of excluded directories from xopy
          "ABfiles" | Out-File $excludeFile2
          "Meeting.Active" | Out-File $excludeFile2 -Append
          "DfsrPrivate" | Out-File $excludeFile2 -Append
          $excludeFile3 = $env:temp + "\excludedev.txt"
          #List of excluded directories from xopy
          "DeviceUpdateStore" | Out-File $excludeFile3
          "Meeting.Active" | Out-File $excludeFile3 -Append
          "DfsrPrivate" | Out-File $excludeFile3 -Append
      
      I am also looking on excluding WinFab files in an upcoming release.
      Cheers,
      Lasse
    • I am working on an update to take care of the issues mentioned by tobewah.
      But yes Skakke, you are right. Just make sure you also add the statement for excludefile2 and 3 if you use those options.
      
      Cheers,
      Lasse
  • Thanks
    1 Posts | Last post October 23, 2016
  • XCopy message: sharing violation
    2 Posts | Last post September 19, 2016
    • First of all, great work! Save a lot of of time automatizing backup task. Thank you for the script.
      
      I'm experiencing an error in the script when backing up FileStores from some of the pools in my topology, I found that it simply hang and can continue running forever (I think) when issuing the command :
      
      Xcopy *.* $filepath22 /E /I /Y /H /C /EXCLUDE:$excludeFile1 | out-null
      
      Nothing more is shown, I have to kill the task, the only backup I get is the data generated from preceding tasks in the script.
      
      I noticed that removing the parameter /EXCLUDE script can continue, but showing a message that states "sharing violation", I suppose it is due to file lock out, after all, nothing is being written in the path where it is supposed to be backed up.
      
      Problem started to happen after lastest CU for Lync 2013 were installed three weeks ago, for now, I'm halting FileStore function and making manual backup from that part.
      
      Any advice will be greatly appreciated, thanks in advance.
      
      
    • Sorry for the late reply,
      I'm not aware of any changes in CU's breaking my code so far.
      The error messages you see, are usually related to one of the two "issues":
      1) The file you are trying to back up is in use by an existing conference or other function: I Advice you to run the script outside of busy hours
      2) The exclude command uses a temp file. Make sure the script has access to the temp are (userenv temp of the user running the script), and that it is not blocked by any a/v software.
      
      Hope this helps.
  • Pool Backup and Filestore switch
    2 Posts | Last post March 05, 2016
    • Maybe I'm missing it, I don't see a switch to target a specific pool.  Great script, but in multi-pool enviroments, it seems to want to grab every pool.
      
      On a different note, on one customer site I couldn't use it because the file share has some sort of shortcut place holder, so the script started backup everything down the shortcut, was weird.  Another handy switch would be to exclude the Filestore backup all together.  many environments already have that backed up through a regular solution.
    • Hi,
      
      The reason why I decided to backup everything, was to keep the script as uncomplicated as possible. Which is why it runs several get commands to discover pools and services. If I rewrote the script to target specific pools, I would still have to decide which services each pool was running. I have played with the idea, but not had the time to really build a good switch setup to allow for the flexibility you ask for. It might surface one day.
      
      But a switch to skip all the file services could be a good idea, so I'll set it on my request list for an upcoming release.
      
      Thanks!
  • Xcopy error
    9 Posts | Last post February 29, 2016
    • Hi Lasse!
      First, I will just say that you have done a very good job.
      I have a problem with xcopy. The error message is the following:
      Xcopy: Insufficient memory
      That \\ filepath \ some folder \ Backup SFB.ps1: 291 char: 21
      Xcopy *. * $ Filepath2 / E / I / Y / H / C / EXCLUDE: $ excludeFile1 ..
      
      Is this an error message that I should look into?
      
      We have installed the latest version of Skype for Business
    • Right,
      
      This is an error I suspect it related to xcopy and the length of the name of your files: http://www.terminally-incoherent.com/blog/2007/02/05/xcopy-insufficient-memory/
      
      It may be your poolnames are so long it creates an issue as described in the post above.
      Can you try to use a switch (-Backupto) to change the path? Set it to "c:\bu" for example?
    • Thanks for quick feedback!
      Changed -Backupto to "c:\g", got the same error message as last time.I read the article that you refer to. It could be the problem.
      Our FQDN pool name is xxxxxxxxxxxxx.xxxx.xx in length
    • Hi again, 
      Are you running the latest version. i know I edited the script not to use fqdn in filenames, but hostnames... I was wondering if the "bug" was back.
    • Hi, 
      
      If you think of the script it is V 4.01 -February 2016
    • I dod also run dir \\xxx.xx\xxxxxxx\xxxxx  -Recurse| select fullname | % {if ($_.fullname.length -gt 240) {write-host $_.fullname} }
      to se if there where any paths longer than 240, got none hits
    • Hi
      We run DFS file system. In the backup.zip folder created by the script I saw that a folder named DFSrPrivate was backed up. When I did exclude the folder in the script, everything went well
    • Glad to hear you got it to work.
      So it was the total length of the path that triggered the error.
      I'll see if I can smarten the paths on my side one day. But I do like paths to be self explanatory :)
      
      Cheers!
      
    • Yes, it was the length of the path. The folder DFSrPrivate do mess it up. When thats was taken care of:), everything is ok. Thanks for the help and have a nice day
1 - 10 of 15 Items