Purpose of 5 minute Admin
To provide Skype for Business Administrators with code snippets to help with day to day administration tasks without the need to remember PowerShell commandlets and parameters.
ExportArchivingData.ps1
This script will export archiving data from SQL to a folder of your choice
################################################################## # SCRIPT TITLE: EXPORTARCHIVINGDATA # # VERSION: 1.0 # # LICENCE: FREE UNRESTRICTED # # SUPPORT: WWW.SKYPE4B.UK # # CREATOR: MARK VALE # # WARRANRY: NONE - USE AT OWN RISK # # SYNOPSIS: SCRIPT TO EXPORT ARCHIVING DATA TO EML FILES FOR # # INSTANT MESSAGE RECOVERY # ################################################################## Import-Module SkypeforBusiness $user = Read-Host "Enter user SIP Address or leave empty for all": $startdate = Read-Host "Enter Start Date e.g. 1/9/2015:" $enddate = Read-Host "Enter End Date e.g 5/9/2015 or leave blank for none:" ############################################################################ # Change Report Path if Required # ############################################################################ $reportpath = "C:\SfBArchivingData\" $archdatabase = Get-CsService -ArchivingDatabase | Select Identity if (!(Test-Path $reportpath)){ New-Item -ItemType Directory -Path $reportpath -Force } If (!($user)){ try{ if (!($enddate)){ Export-CsArchivingData -Identity $archdatabase.Identity -StartDate $startdate -OutputFolder $reportpath }else{ Export-CsArchivingData -Identity $archdatabase.Identity -StartDate $startdate -EndDate $enddate -OutputFolder $reportpath } } catch{ write-Host -ForegroundColor Red -BackgroundColor Black "Failed to export Archiving Data $($_.ExceptionMessage)" } }else{ try{ if (!($enddate)){ Export-CsArchivingData -Identity $archdatabase.Identity -UserUri "sip:$($user)" -StartDate $startdate -OutputFolder $reportpath }else{ Export-CsArchivingData -Identity $archdatabase.Identity -UserUri "sip:$($user)" -StartDate $startdate -EndDate $enddate -OutputFolder $reportpath } } catch{ write-Host -ForegroundColor Red -BackgroundColor Black "Failed to export Archiving Data $($_.ExceptionMessage)" } }
Files will be exported to .EML files which can be opened using Outlook.
Mark is an Independent Microsoft Teams Consultant with over 15 years experience in Microsoft Technology. Mark is the founder of Commsverse, a dedicated Microsoft Teams conference and former MVP. You can follow him on twitter @UnifiedVale