Public/Set-HPDCAllocationPolicy.ps1
Function Set-HPDCAllocationPolicy { <# .SYNOPSIS Sets the cache allocation policy for a specified disk. .DESCRIPTION Sets the cache allocation policy for a specified disk. .PARAMETER DiskNumber The number of the disk to configure the Allocation Policy for. .PARAMETER AllocationPolicy The allocation policy to set. Valid options are: static, dymanic .INPUTS System.Int System.String .EXAMPLE Set-HPDCAllocationPolicy -DiskNumber 0 -AllocationPolicy Dynamic Set the allocation policy on disk 0 to Dynamic .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)] [Int]$DiskNumber, [Parameter(Mandatory = $true)] [ValidateSet("static", "dynamic")] [String]$AllocationPolicy ) If ($Null -ne $HpDC) { If ($PSCmdlet.ShouldProcess($DiskNumber, "Set allocation policy to $AllocationPolicy")) { $Ret = $HpDC.SetAllocationPolicy($DiskNumber, $AllocationPolicy) If ($Ret.ReturnValue -gt 0) { Throw "Allocation policy NOT set on disk $DiskNumber - Error: $Ret.ReturnValue" } Else { Write-Output "Allocation policy set on disk $DiskNumber to $AllocationPolicy" } } } } |