Public/SmartClientProfiles/Get-EffectiveSmartClientProfile.ps1

#Requires -Modules 'MilestonePSTools'

function Get-EffectiveSmartClientProfile {
    <#
    .SYNOPSIS
        Gets the effective Smart Client Profile for the given user account Sid
    .DESCRIPTION
        If the given Sid is not valid or recognized, the Default Smart Client Profile will be returned. Otherwise,
    .EXAMPLE
        PS C:\> Get-EffectiveSmartClientProfile -Sid $userSid | Select Name, Id
        Gets the effective Smart Client profile for the given $userSid value, and selects the Name and Id properties to show in the terminal
    .OUTPUTS
        The output of this function will be a [VideoOS.Management.VmoClient.SmartClientProfile] object
        with the following properties:
 
        Name : Remote Guard
        Description :
        LastModified : 1/22/2021 7:59:12 PM
        SettingsXml : <Settings>
                                        <Setting key="SettingKeyName">
                                        <Value>Example</Value>
                                        <Locked>False</Locked>
                                        </Setting>
                                      </Settings>
        IsDefaultProfile : False
        AttachedRoles : {}
        Id : e73e6ddf-8493-48e9-8e48-04b36023538d
        IsDirty : False
        IsCreated : True
        IsDeleted : False
        Exists : True
        CustomProperties : {}
        IsCustomPropertiesSupported : True
        ServerVersion : 20.3.1
    #>

    [CmdletBinding()]
    [OutputType([VideoOS.Management.VmoClient.SmartClientProfile])]
    param(
        # Specifies the display name of the ViewGroup. Wildcards are supported.
        [Parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)]
        [ValidateNotNullOrEmpty()]
        [string]
        $Sid
    )

    begin {
        $vmo = Get-VmoClient
    }

    process {
        try {
            Write-Output ($vmo.ManagementServer.ClientProfileSection.GetSmartClientProfileBySid($Sid))
        }
        catch {
            $vmo.Dispose()
            throw
        }
    }

    end {
        $vmo.Dispose()
    }
}