Backup script for Lync 2013

This script is no longer aviailable, please use to the new and updated Backup-sfb.ps1.It will cover Lync 2013 and SfB installations (and some 2010 components).https://gallery.technet.microsoft.com/Backup-Skype-for-Business-8194d0b6Read more about the script at: http://uc.lawedo.n

 
 
 
 
 
4.6 Star
(25)
Add to favorites
Lync
6/15/2015
E-mail Twitter del.icio.us Digg Facebook
  • Script Error
    4 Posts | Last post May 18, 2015
    • Great Script. It seems to run but I get the below error. Is it anything to be concerned with?
      
      You cannot call a method on a null-valued expression.
      At C:\Scripts\Backup-Lync2013.ps1:462 char:31
      +                     $db1X = $($db1[1]).ToUpper()
      +                               ~~~~~~~
          + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
          + FullyQualifiedErrorId : InvokeMethodOnNull
    • Hi,
      Seems like the script missed something  during the gathering of information.
      Which version are you running? Could you the the Backup-SFB script as well? I have done some changes to the sql backup there.
      Run the script with -debugsql switch, and see what's happening.
    • Our SQL team do the SQL backups, I wonder if it is something to do with that and maybe they have changed the settings.
      
      Thde -debugsql came up with the below:
      
      SQL version found: 10.50.4000
      You cannot call a method on a null-valued expression.
      At C:\Scripts\Backup-Lync2013.ps1:462 char:31
      +                     $db1X = $($db1[1]).ToUpper()
      +                               ~~~~~~~
          + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
          + FullyQualifiedErrorId : InvokeMethodOnNull
      
      Test of  or DEFAULT vs DEFAULT
      You cannot call a method on a null-valued expression.
      At C:\Scripts\Backup-Lync2013.ps1:462 char:31
      +                     $db1X = $($db1[1]).ToUpper()
      +                               ~~~~~~~
          + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
          + FullyQualifiedErrorId : InvokeMethodOnNull
      
      Test of  or DEFAULT vs MSSQL02
      You cannot call a method on a null-valued expression.
      At C:\Scripts\Backup-Lync2013.ps1:462 char:31
      +                     $db1X = $($db1[1]).ToUpper()
      +                               ~~~~~~~
          + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
          + FullyQualifiedErrorId : InvokeMethodOnNull
      
      Test of  or DEFAULT vs RTC
      You cannot call a method on a null-valued expression.
      At C:\Scripts\Backup-Lync2013.ps1:462 char:31
      +                     $db1X = $($db1[1]).ToUpper()
      +                               ~~~~~~~
          + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
          + FullyQualifiedErrorId : InvokeMethodOnNull
      
      Test of  or DEFAULT vs RTCLOCAL
    • Although the Skype for Business backup worked a treat!! Thank you so much for this.
  • SQL-Mirroring
    3 Posts | Last post May 12, 2015
    • hi Lasse,
      I love your script. I have been using it to backup our Lync 2013 perfectly fine, until we had a SQL issue and had to failover to the backup SQL server (Mirrored DB). Your script still run, but it couldn't located the 2nd SQL server to backup.
      Do I have to edit anything to get it to work? I'm running version 3.5, which was released in October 2014.
    • Hi,
      You are correct, the script was written to avoid mirror databases. 
      If you run the script with -DebugSQL, does it give any output regarding the databases at all?
      Is this problem related strictly to the database backup, or other services as well?
      
      This is what I do to capture which db to backup (search for "if (!$SkipCMSDB.IsPresent)" in the script to get to the important path)
      
      For cms, I use the following: "$server = (Get-CsConfigurationStoreLocation).backendserver"
      Looking at the Get-CsConfigurationStoreLocation, it has a mirrorbackendserver property as well. You can edit the script to use that property.
      
      The same is true for most other databases in the script. I call the "$servers = get-csservice -UserServer" to find databases. Here I use the "$serverX.Userdatabase", which could be edited to "$serverX.MirrorUserdatabase" if you want it to run on mirrors.
      
      I hope this helps
    • hi Lasse,
      I have 2 servers: SQL01 and SQL02. 
      I just want it to run on SQL01. However, we had issue on SQL01 so all DB failed over to SQL02, where the Mirrored Database become production, then do I need to edit the script so that it can backup SQL02?
      
      
      
  • 2008 R2 Servers can you help????
    5 Posts | Last post April 09, 2015
    • Love the script I was wondering if you could modify it to work with 2008 R2 servers that is currently my companies entire environment.
    • Hi Jonathan,
      It should run on a 2008 R2 server, if you upgrade powershall to the latest release.
      Have you run into any issues?
      (I know the readme says 2012, but that's because I KNOW it comes with all the right versions)
      If you're running it from a Lync 2013 Server computer, you should be fine.
    • So I did run it on our environment all of the folders had the correct folder structure but were empty except for the FileshareData folder that contained a few files. All of the xml files had data in them...
    • That was strange, 
      Is this a Lync 2013 or a Lync 2010 solution?
      Have you tried the -DebugSQL switch? It could provide some clues.
    • This is Lync 2013... so the second time I ran the script it collected a lot of data that wasn't collected the first time i'm not sure what changed but I will run again and report my findings.
  • Verbose Logging
    2 Posts | Last post March 30, 2015
    • Thanks so much the the script... amazingly helpful.
      I was curious if there was clean way to make a 'logfile' of the verbose results of the command that can be included in the zip?  I'd be interested to be able to look into the log file and examine the errors (if applicable).  Or, perhaps i'm completely missing something  :)
      THANKS AGAIN!
    • Hi Greg, 
      Thanks for the feedback.
      My short answer is: "No, there is not"
      I have tried several ways to do this, but in the end I went for speed and tidyness, not logging.
      I might look into it again, when I start preparing for the Skype for Business release. 
      Previously I used "start-transcript", but it introduced to many "issues" I didn't have time to solve. ;)
  • Regarding Backup status Report ?
    2 Posts | Last post March 03, 2015
    • Hi Lasse, It is really wonderful tool. Need your help to understand, 
      Is there any PowerShell command to add in this script itself to send an automated email about the status of the backup script ?
      
      Thanks in advance.
    • Hi,
      I'm sorry, I have not made any reports through e-mail available in this script.
      I will write it down on my "things to consider list" for a future update ;)
      
      However, if you add something like this after the Zip- job (Line 724 +++ or so), you should be able to at least send a "it's been run" msg:
      
      send-mailmessage -to "ENTER EMAIL ADDRESS HERE" -from "ENTER FROM ADDRESS HERE" -body "Backup script was run, and files can be found at $filepath1" -subject "Backupscript was run" -smtpServer ENTER.MAIL.FQDN
      
      Lasse
  • Sharing violation....Galore
    2 Posts | Last post January 14, 2015
    • Lasse,
      Seems like I am hung at this operation??
      
      Does it time out do I need to kill it?
      
      Idea's??
      
      <#Backup Filestores#>
      Write-Progress -Activity "Running System Backup" -status "Filestores" -percentComplete ($Progress / 12*100)
      backup-filestores
      $Progress ++
      
      
      Thanks,
      Jim
    • I do not know why this is an issue for you. Have you used any swithces to include phoneloads or something (can be quite large). It should time out if access is denied.
  • STDMode
    2 Posts | Last post November 17, 2014
    • Great job Lasse! Can you please confirm if switch -STDMode is required in a Lync Standard Edition environment. I see it as a option in backup-lync2013.ps1 notes, but I don't see it as a defined parameter in the script. 
      
      Also, in our case where we have two Lync STD pools, it looks like it tries to export the db from the other Lync server, but fails. Is this expected behavior? As shown below, backup-lync2013.ps1 is being run from lync001 but it tries to backup sql on lync002 and errors out "cannot open backup device....". 
      
      Both Lync001 and Lync002 are standard edition servers. 
      
      Backup-SqlDatabase : System.Data.SqlClient.SqlError: Cannot open backup device
      '\\LYNC001.###.com\lyncbackup\2014_11_17-10_03\SQLBU\lync002.###.com\AppDB\Cpsdyn_full_111714.bak'. Operating system error 67(The network
      name cannot be found.).
      At C:\LyncBackup\Backup-Lync2013.ps1:482 char:29
      +                             Backup-SqlDatabase -Database $database
      -BackupFile $ ...
      +
      
      Thanks Again!
    • Hi Kyle,
      Thanks for the feed back. Sorry about the STDMode. I think that's an old parameter who managed to creep back in there.
      
      On the SQL thing, yes, it should backup all SQL bases, and it needs database access and network access to server.
      
      I could possibly understand more if you provided some debug information using the DebugSQL switch. 
      
      It does however look like the user account is unable to copy/connect to the temporary share the script creates. Can you verify the share is created?
      
      Best regards,
      Lasse
  • Sharing violation - ctd
    3 Posts | Last post October 30, 2014
    • So the exact sequence is:
      
      System Error 85 has occurred
      The local device name is already in use
      Sharing Violation
      
    • And then it threw an insufficient memory error.
    • Do you already have a drive mapped to the file Share? Or do you have a drive y: already in use?
      Those two are common "errors"
  • Sharing Violation
    2 Posts | Last post October 30, 2014
    • Appears to be around the filestore backup portion of the script.
    • Yes, you may encounter the sharing violation when copying files in use. 
      It's more like a warning, and it can be ignored. 
  • Error
    1 Posts | Last post October 29, 2014
    • Running the script and getting Sharing violation errors near what I take to be the end of the script. Any pointers?
1 - 10 of 26 Items