December 30 2010

Scheduled task Powershell script to backup Lync Server 2010 config

I’ve created a simple Powershell script to run daily to backup Lync configuration with the export-csconfiguration command:

cd $env:UserProfile
Import-Module 'C:Program FilesCommon FilesMicrosoft Lync Server 2010ModulesLyncLync.psd1'
$filename = "d:backup{}" -f (Get-Date)
export-csconfiguration -Filename $filename -Force:$True

For example, put the above code into a document called d:backupbackup.ps1 and then create a scheduled task to execute the command on a daily basis:

powershell -command d:Backupbackup.ps1

This can run in the SYSTEM context. Simples!

I use a maximum of one Google Ad per post to help offset some of my blog hosting costs.