public/Format-CTSDCard.ps1
Function Format-CTSDCard { [cmdletBinding( DefaultParameterSetName='All', SupportsShouldProcess = $true, ConfirmImpact='high' )] Param( [Parameter( Mandatory=$true, ParameterSetName='All' )] [String]$IP, [Parameter( Mandatory=$true, ParameterSetName='All' )] [pscredential]$Credential, [Parameter( Mandatory=$false, ParameterSetName='All' )] [String]$Storage ) DynamicParam { $DynamicParameters = @{ CameraType = @{ Mandatory = $true Position = 1 ParameterSetName = "All" Enum = $Script:SupportedCameraModels } <#Storage = @{ Mandatory = $true Position = 2 ParameterSetName = "All" Enum = $Script:SupportedCameraModels } #> } return New-DynamicParameterSet -ParameterTable $DynamicParameters } Begin { Write-Debug "[Format-CTSDCard] Started" $CameraType = $PSBoundParameters.CameraType #Build Submission Object $obj = @{ IP = $IP Credential = $Credential } if($Storage) { $obj.Add('Storage',$Storage) } #Message Setup $SPDescription = "Storage Operation" $SPWarning = "This action will remove all data from the SD Card. Are you sure you want to do this?" $SPCaption = "Formatting SD Card" if($PSCmdlet.ShouldProcess($SPDescription,$SPWarning,$SPCaption)) { Switch ($CameraType) { Hanwha { return Format-HanwhaSDCard -Object $obj } } } } } |