#Skype4B/Lync Script: Show User Policy

Show-Skype4BUserPolicy is one of the many PowerShell functions/utilities in my personal script toolbox repository designed to help simplify the management and administration of just about any Lync / Skype for Business Server environments.

It is a companion to Compare-Skype4BUserPolicy for the purpose of displaying information (user policy) in a more readable and useful format (rotate pivot-table). Enjoy!

################################################################################
# Copyright (c) 201x-2017 leedesmond.com
# All Rights Reserved. Use at your own risk and responsibility.
# Show-Skype4BUserPolicy.ps1
# Version 1.00
# Companion to Compare-Skype4BUserPolicy.ps1
#
# USAGE:
# Show-Skype4BUserPolicy (Compare-Skype4BUserPolicy $u1 $u2 -DistinctObject)
#
# INPUT:
# Output from Compare-Skype4BUserPolicy with -DistinctObject. The switch
# -ShowMoreAttributes against Show-Skype4BUserPolicy() is optional.
#
# OUTPUT:
# Displays output in a text tabular or GUI format (pipe to Out-GridView)
#
#requires -version 3.0
################################################################################
#
function Show-Skype4BUserPolicy()
{
[cmdletBinding()]
param(
[array]$rvd,
[switch]$ShowMoreAttributes
)

$onp = $rvd[0] | Get-Member -MemberType NoteProperty;

$exclProp = “FirstName,LastName,UserRoutingGroupId,Identity,HomeServer,DistinguishedName,ProxyAddresses,WhenChanged,WhenCreated”;
$exclProp = $exclProp -split “,”;

$oarr = @();
$onp.name | % {
if (-not ((!$ShowMoreAttributes) -and ($_ -in $exclProp))) {
$name = $_;
$o1 = New-Object Psobject;
$o1 | Add-Member -MemberType NoteProperty -Name Property -Value $name;
$o1 | Add-Member -MemberType NoteProperty -Name $rvd[0].SamAccountName -Value $rvd[0].$name;
$o1 | Add-Member -MemberType NoteProperty -Name $rvd[1].SamAccountName -Value $rvd[1].$name;
$oarr += $o1;
}
}
$oarr | Sort-Object Property;
} #Show-Skype4BUserPolicy()
################################################################################

Leave a Reply