Home > Lync Server/Skype for Business Server > Script: New-CsClonedPolicy.ps1 – Clones Existing Lync 2013 Policy To a New Policy

Script: New-CsClonedPolicy.ps1 – Clones Existing Lync 2013 Policy To a New Policy

Download PDF

Lync 2013 logo 128x128Description

Some Lync 2013 policies have few parameters, like User Services Policies. Others, like Conferencing Policies, have a considerable number of parameters. Often, organizations need to have different policies for different groups of people. Many times, there is only one or two settings that are different. Creating a new policy based on an existing policy can be time consuming. There are some cool utilities like Kevin Peters’ cool StareCompare, which shows where policy settings are different between two policies. But what if it was just easier to “clone” an existing policy to a new policy, and then just change the few settings that need changing? NextHop has a nice article on how to just that. You export the current policy to an XML file, edit the file, then import it into a new policy. Must faster, but still requires some manual editing of an XML file. Ya know why I don’t like that method? Not enough PowerShell! So what I did was write a script that automates that method, and allows you to clone an existing policy to a new policy in one step. The script exports the existing “source” policy, updates the XML, then imports into the “target” policy. One command to make life easier. Then you can use the appropriate “set” cmdlet to tweak the new policy. And it works with all Lync 2013 policy types, including Archiving, Client, ClientVersion, Conferencing, ExternalAccess, HostedVoicemail, Location, Mobility, NetworkInterSite, PersistentChat, Pin, Presence, UserServices, Voice, and VoiceRouting. The script only works with Lync 2013 policies, and only runs on PowerShell 3.0 or higher (Windows Server 2012 or later).

The script supports Get-Help, so run that if you need additional info.


New-CsClonedPolicy.ps1 [[-ExportFolder] ] [[-ExportFile] ] [[-SourcePolicyName] ] [[-TargetPolicyName] ] [[-PolicyType] ]
[[-Description] ] []

An example would be

New-CsClonedPolicy.ps1 -SourcePolicyName global -TargetPolicyName "new policy" -PolicyType ConferencingPolicy

This would clone the global conferencing policy into a new policy called “new policy”. Acceptable values for PolicyType are “ArchivingPolicy”, “ClientPolicy”, “ClientVersionPolicy”, “ConferencingPolicy”, “ExternalAccessPolicy”, “HostedVoicemailPolicy”, “LocationPolicy”, “MobilityPolicy”, “NetworkInterSitePolicy”, “PersistentChatPolicy”, “PinPolicy”, “PresencePolicy”, “UserServicesPolicy”, “VoicePolicy”, and “VoiceRoutingPolicy”


Execution Policy: Third-party PowerShell scripts may require that the PowerShell Execution Policy be set to either AllSigned, RemoteSigned, or Unrestricted. The default is Restricted, which prevents scripts – even code signed scripts – from running. For more information about setting your Execution Policy, see Using the Set-ExecutionPolicy Cmdlet.


v1.2 – 06-10-2014 – New-CsClonedPolicy.v1.2.zip

v1.1 – 02-08-2014 – New-CsClonedPolicy.v1.1.zip

v1.0 – 09-03-2013 – New-CsClonedPolicy.v1.0.zip


See the changelog for information on what’s changed/included in each version.

  1. Fernando
    March 28th, 2014 at 19:15 | #1

    Hi, thanks for the script.
    In line 96, I had to change $SourcePolicyName by `”$SourcePolicyName`” , otherwise if policy has spaces it would break.

    • Pat Richard
      March 30th, 2014 at 17:12 | #2

      I figured someone would mention this. I already had it fixed in v1.2, but haven’t finished testing the new version yet. Should be out very soon.


  2. Craig
    October 22nd, 2015 at 22:02 | #3

    The script creates a new policy but it adds the string “Tag:” in front of the new policy name.

    This also happens when I use the manual method you mention at the beginning of this post. If think it’s a bug in the parsing engine of the import-clixml commandlet.

    • Pat Richard
      October 22nd, 2015 at 23:09 | #4

      That’s automatic in Lync, and as designed.

  3. Craig
    October 26th, 2015 at 15:42 | #5

    So you end up with all your copied policies stating with “Tag:” then?

  1. April 19th, 2015 at 07:14 | #1