Public/Set-HPWFCacheSize.ps1
Function Set-HPWFCacheSize { <# .SYNOPSIS Sets the cache size for the protected volume on reboot. .DESCRIPTION Sets the cache size for the protected volume on reboot. .PARAMETER DriveLetter The DriveLetter to set the CacheSize for. .PARAMETER CacheSize The size of the cache. .INPUTS System.IO.DriveInfo System.Int .OUTPUTS Returns 0 when successful. Otherwise, it returns an error code. .EXAMPLE Set-HPWFCacheSize -DriveLetter C: -CacheSize 256 .EXAMPLE Another example of how to use this cmdlet .LINK about_functions_advanced .LINK about_CommonParameters .LINK http://h10032.www1.hp.com/ctg/Manual/c06173592 #> [CmdletBinding( SupportsShouldProcess = $true, ConfirmImpact = "Medium" )] Param( [Parameter( Mandatory = $True )] [ValidateScript( { Test-IsDriveLetter $_ } )] [System.IO.DriveInfo]$DriveLetter, [Parameter( Mandatory = $True )] [ValidateScript( { [Convert]::ToInt64($_) } )] [Int]$CacheSize ) If ($null -ne $HpWF) { If ($PSCmdlet.ShouldProcess($Driveletter, "Set CacheSize to $CacheSize")) { $Ret = $HpWF.SetCacheSize($DriveLetter, $CacheSize) If ($Ret.ReturnValue -gt 0) { Throw "Setting max cache size on volume $DriveLetter failed with error $Ret.ReturnValue" } Else { Write-Output "Setting max cache size on volume $DriveLetter succeeded!" } } } } |