Public/Enable-UWFFeature.ps1

Function Enable-UWFFeature {
    <#
        .SYNOPSIS
            Install Unfied Write Filter feature
        .DESCRIPTION
            Install Unfied Write Filter feature
        .INPUTS
            None
        .LINK
            about_functions_advanced
        .LINK
            about_CommonParameters
    #>

    [CmdletBinding(
        SupportsShouldProcess = $true
    )]
    [OutputType('String')]
    Param( )

    Begin {
        If (-not $PSBoundParameters.ContainsKey('Verbose')) {
            $VerbosePreference = $PSCmdlet.SessionState.PSVariable.GetValue('VerbosePreference')
        }
        If (-not $PSBoundParameters.ContainsKey('WhatIf')) {
            $WhatIfPreference = $PSCmdlet.SessionState.PSVariable.GetValue('WhatIfPreference')
        }
        If (-not $PSBoundParameters.ContainsKey('Confirm')) {
            $ConfirmPreference = $PSCmdlet.SessionState.PSVariable.GetValue('ConfirmPreference')
        }
        If (-not $PSBoundParameters.ContainsKey('ErrorAction')) {
            $ErrorActionPreference = $PSCmdlet.SessionState.PSVariable.GetValue('ErrorActionPreference')
        }
    }

    Process {
        If ($PSCmdlet.ShouldProcess($env:COMPUTERNAME, "Install Unified Write Filter")) {
            $UWFFeatureState = (Get-WindowsOptionalFeature -FeatureName "Client-UnifiedWriteFilter" -Online -ErrorAction SilentlyContinue).State
            If ($UWFFeatureState -eq "Disabled") {
                Enable-WindowsOptionalFeature -FeatureName "Client-UnifiedWriteFilter" -NoRestart -Online -All
            }
        }
    }

    End {

    }
}
Set-Alias -Name Install-UWFFeature -Value Enable-UWFFeature -Option ReadOnly