Public/Set-HPDCFlushTimeInterval.ps1

Function Set-HPDCFlushTimeInterval {
    <#
        .SYNOPSIS
            Sets the flush interval of the cache.
        .DESCRIPTION
            Sets the flush interval of the cache. Data will not remain in the cache for longer than the flush time interval specified in seconds.
        .PARAMETER DiskNumber
            The disknumber to set the flush interval for.
        .PARAMETER FlushTimeInterval
            The interval in seconds.
        .INPUTS
            System.Int
        .OUTPUTS
            Returns 0 when successful. Otherwise, it returns an error code.
        .EXAMPLE
            Set-HPDCFlushTimeInterval -DiskNumber 0 -FlushTimeInterval 300
 
            Set's the flush interval for disk 0 to 300 seconds
        .LINK
            about_functions_advanced
        .LINK
            about_CommonParameters
        .LINK
            http://h10032.www1.hp.com/ctg/Manual/c06173592
    #>

    [CmdletBinding(
        SupportsShouldProcess = $true,
        ConfirmImpact = "Medium"
    )]
    Param(
        [Paramter(
            Mandatory = $true,
            HelpMessage = "The disknumber to set the flush interval for."
        )]
        [Int]$DiskNumber,
        [Paramter(
            Mandatory = $true,
            HelpMessage = "The interval in seconds."
        )]
        [Int]$FlushTimeInterval
    )
    If ($Null -ne $HpDC) {
        If ($PSCmdlet.ShouldProcess($DiskNumber, "Set the flush interval to $FlushTimeInterval seconds")) {
            $Ret = $HpDC.SetFlushTimeInterval($DiskNumber, $FlushTimeInterval)
            If ($Ret.ReturnValue -gt 0) {
                Throw "Flush time interval NOT changed on disk $DiskNumber - Error: $Ret.ReturnValue"
            } Else {
                Write-Output "Flush time interval set to $FlushTimeInterval on disk $DiskNumber on next boot"
            }
        }
    }
}