Freigeben über


Powershell Lync Export & Import Script for Users Contacts... for DR?

So if you want to export and import the contact information between to pools for DR here is 2 simple powershell scripts that will help.

This will also move the users from the primary to the backup pool so the backup pool becomes their primary register

you could include this as a larger DR script to backup the rtc database and voice routing etc...

Import Script

 

#Configure these Variables to your environment
###########################################################
$importpath = "c:\share\"
$primarylync = "lync-01.corp.contoso.com"
$backuplync = "lync-02.corp.contoso.com"
###########################################################

Import-module Lync
get-CSUSER -Filter {RegistrarPool -eq $primarylync} |Move-CSUser -Target $backuplync

$dbimport = "C:\Program Files\Common Files\Microsoft Lync Server 2010\Support\dbimpexp.exe"
$xml = $exportpath + "AllUserscontact.xml"
& "$dbimport" /import /HRXMLfile:$xml /restype:user

 

 

Export Script

 

#Configure these Variables to your environment
###########################################################
$backuplync = "\\lync-02\share"
$dbimport = "C:\Program Files\Common Files\Microsoft Lync Server 2010\Support\dbimpexp.exe"
###########################################################
$exportpath = "c:\share\"
$xml = $exportpath + "AllUserscontact.xml"
& "$dbimport" /HRXMLfile:$xml

copy $xml $backuplync

Comments

  • Anonymous
    January 01, 2003
    Thanx John McCabe PFE, That was a nice crafty script.   This script once again shows the power of the dbimpexp.exe support tool. This tool enables the exporting and importing of users' contact. In cross forest environment, some have resorted to "manually" (through a script) changing the "sip domain" in the xml file (exported users contact stored in xml) the get-CSUSER combination of Move-CSUser along with the "dbimpexp" is a crafty way of getting this done (within same forest though)

  • Anonymous
    January 01, 2003
    Agreed, crafty. :)