Public/SmartClientProfiles/Remove-SmartClientProfile.ps1

#Requires -Modules 'MilestonePSTools'
function Remove-SmartClientProfile {
    [CmdletBinding(SupportsShouldProcess, ConfirmImpact='High')]
    param (
        # Specifies the Smart Client Profile to Remove
        [Parameter(Mandatory, ValueFromPipeline, ParameterSetName='ByObject')]
        [VideoOS.Management.VmoClient.SmartClientProfile[]]
        $SmartClientProfile,
        [Parameter(Mandatory, ValueFromPipeline, ParameterSetName='ByName')]
        [string]
        $Name
    )

    begin {
        $vmo = Get-VmoClient
    }

    process {
        try {

            if ($null -eq $SmartClientProfile) {
                $SmartClientProfile = Get-SmartClientProfile -Name $Name
            }

            foreach ($profile in $SmartClientProfile) {
                if ($PSCmdlet.ShouldProcess("Smart Client Profile '$($profile.Name)'",'Remove')) {
                    $profile.Delete()
                }
            }
        }
        catch {
            $vmo.Dispose()
            throw
        }
    }

    end {
        $vmo.Dispose()
    }
}