Using Cmdlets for Configuration Tasks

As one might logically expect, the policies and configurations can also be created through cmdlets; for example:

New-CsArchivingConfiguration -Identity "site:Santa Clara" -EnableArchiving ImAndWebConf -EnablePurging:$True -PurgeExportedArchivesOnly:$False -BlockOnArchiveFailure:$False -KeepArchivingDataForDays:120 -ArchiveDuplicateMessages:$False

Notice the last argument set in this command: ArchiveDuplicateMessages. This is a good example of where there are options available through the cmdlets that aren’t exposed to the GUI tools.

The power of using cmdlets to manage an application, such as Lync Server 2013, becomes readily evident when you are dealing with a large implementation. By scripting the configuration of the entire environment, you are able to eliminate the human error introduced by having a distributed group of people perform repetitive tasks. Similarly, the script written to perform the configuration immediately becomes the documentation of the configuration. If later changes need to occur, you can perform queries to find the objects and modify them at the same time. If you plan to manage the environment in this manner, it becomes helpful to put some thought into a logical naming convention for policies and configurations. This enables you to search on some common value in the policies and configurations to select them for modification.

In a similar manner, PowerShell-based cmdlets make it easy to pull configuration reports from a large implementation. For example, imagine that your company announced a policy that all IMs will be retained for at least 30 days. More than likely, someone will ask you to make sure that all your configurations retain messages for at least 30 days. Rather than scrolling through the GUI to find configurations with values under 30, you could simply run a cmdlet like the following to produce a report of all configurations in which the CachePurgingInterval is less than 30 days:

Get-CsArchivingConfiguration | Where {$_.CachePurgingInterval -lt "30"} | select Identity

However, if you were going to do that, why not fix it all at once?

$Array=Get-CsArchivingConfiguration | Where {$_.CachePurgingInterval -lt "30"}
Foreach ($Name in $Array)
{
$Var = $Name.Identity
Set-CsArchivingConfiguration -Identity $var -CachePurgingInterval:30
}

This report searches all configurations in the topology and sets any that have a CachePurgingInterval of less than 30 to 30 without touching any that were already higher than 30.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset