This script finds users with specific features enabled in Microsoft Lync Server 2010. Features of following policies which defined in user scope are supported by this script.
Microsoft Lync Server 2010 provides a lot of policies to allow IT administrators to control the features which could be used by end users. Currently, if administrators want to know the list of users who are allowed to use some features, they have to find these policies by using Where-Object cmdlet first. After that they need to prepare a filter script manually by using the policy names. It’s a time consuming job if there are a lot of policies in the organization. Also some administrators want to maintain this kind of list for compliance purpose.
This script contains one advanced function, Search-OSCCsUsers. You can use this script in following ways:
Method 1:
Method 2:
Here are some code snippets for your references. To get the complete script sample, please click the download button at the beginning of this page.
#Prepare feature list for each policy, it will be used for validation
$nonFeatures = "Anchor","Description","Identity","Name","Priority","RuleId","ScopeClass","PolicyEntry"
Switch -regex ($PolicyType) {
"ClientVersion" {
$csSites = Get-CsSite -Verbose:$false
$sitesCount = ($csSites | Measure-Object).Count
if ($sitesCount -eq 1) {
$siteID = $csSites.Identity
} else {
$siteID = $csSites[0].Identity
}
$tempGUID = [System.Guid]::NewGuid()
$ruleTemplate = New-CsClientVersionPolicyRule -Parent "Site:$siteID" -RuleId $tempGUID -InMemory
$ruleTemplate | Get-Member -MemberType Property | %{$policyFeatures.Add($_.Name,$_.Definition)}
break
} "Voice|Conferencing|Pin|ExternalAccess|Location|Client|Presence|Mobility|Archiving" {
$command = "New-Cs$($PolicyType)Policy -Identity `"Template`" -InMemory -Verbose:`$false"
$policyTemplate = Invoke-Expression -Command $command
$policyTemplate | Get-Member -MemberType Property | %{$policyFeatures.Add($_.Name,$_.Definition)}
break
}
}
#Remove any unnecessary features
$nonFeatures | %{$policyFeatures.Remove($_)}
#Prepare feature list for each policy, it will be used for validation$nonFeatures = "Anchor","Description","Identity","Name","Priority","RuleId","ScopeClass","PolicyEntry"Switch-regex ($PolicyType) { "ClientVersion" { $csSites = Get-CsSite -Verbose:$false$sitesCount = ($csSites|Measure-Object).Count if ($sitesCount-eq 1) { $siteID = $csSites.Identity } else { $siteID = $csSites[0].Identity } $tempGUID = [System.Guid]::NewGuid() $ruleTemplate = New-CsClientVersionPolicyRule -Parent "Site:$siteID"-RuleId $tempGUID-InMemory $ruleTemplate|Get-Member-MemberType Property | %{$policyFeatures.Add($_.Name,$_.Definition)} break } "Voice|Conferencing|Pin|ExternalAccess|Location|Client|Presence|Mobility|Archiving" { $command = "New-Cs$($PolicyType)Policy -Identity `"Template`" -InMemory -Verbose:`$false"$policyTemplate = Invoke-Expression-Command $command$policyTemplate|Get-Member-MemberType Property | %{$policyFeatures.Add($_.Name,$_.Definition)} break } } #Remove any unnecessary features$nonFeatures| %{$policyFeatures.Remove($_)}
Example 01: Displays help about Search-OSCCsUser
Command: Get-Help Search-OSCCsUser -Full
Screenshot:
Example 02: Returns users who are allowed to use simultaneous ringing of phones
Command: Search-OSCCsUser -PolicyType Voice -Feature @{"AllowSimulRing"=$true} -Verbose | FT Name,VoicePolicy
Screenshot:
Example 03: Returns users who are not allowed to forward calls.
Command: Search-OSCCsUser -PolicyType Voice -Feature @{"AllowCallForwarding"=$false} -Verbose | FT Name,VoicePolicy
Screenshot:
![]()
Example 04: Returns users who can hold a meeting which allow 10 participants to attend.
Command: Search-OSCCsUser -PolicyType Conferencing -Feature @{"MaxMeetingSize"=10} -Verbose | FT Name, ConferencingPolicy
Screenshot:
![]()
Example 05: Returns users who are able to log on to your Microsoft Lync Server 2010 system by using specific versions of clients.
Command: Search-OSCCsUser -PolicyType ClientVersion -Feature @{"Enabled"=$true;"UserAgent"="OC";"MajorVersion"=4} | FT Name,ClientVersionPolicy
Screenshot:

Example 06: Finds users who can hold a meeting which allow 30 participants to attend, then grant a new conferencing policy.
Command: Search-OSCCsUser -PolicyType Conferencing -Feature @{"MaxMeetingSize"=30} -Verbose | Grant-CsConferencingPolicy -PolicyName "Large Size Meeting" -Verbose
Screenshot:

Before using this script, you need to know the feature names that will be searched. You can use Get-Member to get a list of feature names. Here is one example:
Get-CsClientPolicy | Get-Member -MemberType Property | FT Name
But there are some exceptions when preparing the value of Feature parameter. You can find these exceptions from following list.
Policy: Voice
Example: @{"AllowCallForwarding"=$true; "EnableCallPark"=$false}
Exception: @{"PstnUsages"="Local,Long Distance"}
Note: Not Available
Policy: Conferencing
Example: @{"EnableFileTransfer"=$true; "MaxMeetingSize"=10}
Exception: @{"MaxVideoConferenceResolution"="VGA"; "EnableAppDesktopSharing"="Desktop"}
Note: Available values for MaxVideoConferenceResolution: VGA or CIF. Available values for EnableAppDesktopSharing: Desktop, SingleApplication or None.
Policy: Pin
Example: @{"AllowCommonPatterns"=$true; "MaximumLogonAttempts"=5}
Exception: None
Note: Not Available
Policy: ExternalAccess
Example: @{"EnableOutsideAccess"=$true}
Exception: None
Note: Not Available
Policy: Location
Example: @{"NotificationUri"="sip:notification@corp.contoso.com"}
Exception: None
Note: Not Available
Policy: Client
Example: @{"IMWarning"="Warning Message #01"} @{"ConferenceIMIdleTimeout"="00:30:00"}
Exception:
@{"AddressBookAvailability"="WebSearchAndFileDownload"}
@{"DisplayPhoto"="PhotosFromADOnly"}
@{"P2PAppSharingEncryption"="Supported"}
@{"SearchPrefixFlags"=96}
Note:
Available values for AddressBookAvailability: WebSearchAndFileDownload, WebSearchOnly or FileDownloadOnly
Available values for DisplayPhoto: NoPhoto, PhotosFromADOnly or AllPhotos
Available values for P2PAppSharingEncryption: Supported, Enforced or NotSupported
Regarding the value of SearchPrefixFlags, please read the help of Set-CsClientPolicy cmdlet.
Policy: Presence
Example: @{"MaxCategorySubscription"=400}
Exception: None
Note: Not Available
Policy: Mobility
Available Features: EnableMobility; EnableOutsideVoice
Example: @{"EnableMobility"=$true}
Exception: None
Note: Not Available
Policy: Archiving
Available Features: ArchiveExternal; ArchiveInternal
Example: @{"ArchiveExternal"=$true; "ArchiveInternal"=$true}
Exception: None
Note: Not Available
Policy: ClientVersion
Example: @{"Enabled"=$true; "UserAgent"="OC"; "MajorVersion"=4}
Exception: None
Note: Actually, these features are the components of client version rule. This script will help you to find client version policy which contains specific rule.
Technical Resources:
Windows PowerShell Advanced Function
Get-CsUser
Get-CsVoicePolicy
Get-CsConferencingPolicy
Get-CsPinPolicy
Get-CsExternalPolicy
Get-CsLocationPolicy
Get-CsClientPolicy
Get-CsPresencePolicy
Get-CsMobilityPolicy
Get-CsArchivingPolicy
Get-CsClientVersionPolicyRule
Forum Thread:
Lync CDR which users use simultaneous ring