Public/ManagementClientProfiles/Reset-ManagementClientProfile.ps1
#Requires -Modules 'MilestonePSTools' function Reset-ManagementClientProfile { [CmdletBinding(SupportsShouldProcess, ConfirmImpact='High')] param ( # Specifies the Management Client Profile to reset with the contents of the default Management Client Profile SettingsXml [Parameter(Mandatory, ValueFromPipeline)] [VideoOS.Management.VmoClient.ManagementClientProfile] $ManagementClientProfile, # Pass the Management Client Profile back into the pipeline [Parameter()] [switch] $PassThru ) begin { $vmo = Get-VmoClient } process { try { $defaultProfile = Get-ManagementClientProfile | Where-Object IsDefaultProfile if ($PSCmdlet.ShouldProcess("Management Client Profile '$($ManagementClientProfile.Name)'",'Reset')) { $ManagementClientProfile.SettingsXml = $defaultProfile.SettingsXml $ManagementClientProfile.Update() } if ($PassThru) { Write-Output $ManagementClientProfile } } catch { $vmo.Dispose() throw } } end { $vmo.Dispose() } } |