public/Get-CTSnapshot.ps1
Function Get-CTSnapshot { [cmdletBinding( DefaultParameterSetName='Hanwha', #SupportsShouldProcess = $true, ConfirmImpact='high' )] Param( [Parameter( Mandatory=$true, ParameterSetName='Hanwha' )] [String]$IP, [Parameter( Mandatory=$true, ParameterSetName='Hanwha' )] [pscredential]$Credential, [Parameter( Mandatory=$false, ParameterSetName='Hanwha' )] [String]$Channel, [Parameter( Mandatory=$true, ParameterSetName='Hanwha' )] [String]$OutFile ) DynamicParam { $DynamicParameters = @{ CameraType = @{ Mandatory = $true Position = 1 ParameterSetName = "Hanwha" Enum = $Script:SupportedCameraModels } } return New-DynamicParameterSet -ParameterTable $DynamicParameters } Begin { Write-Debug "[Get-CTSnapshot] Started" $CameraType = $PSBoundParameters.CameraType #Build Submission Object $obj = @{ IP = $IP Credential = $Credential OutFile = $OutFile } if($Channel) { $obj.Add('Channel',$Channel) } #Choose Camera Model Switch ($CameraType) { Hanwha { return Get-HanwhaSnapshot -Object $obj } } } } |