public/Set-CTRecordingStorage.ps1
#https://$($ip)/stw-cgi/recording.cgi?msubmenu=storage&action=set&Enable=True&OverWrite=True&AutoDeleteEnable=True&AutoDeleteDays=90 Function Set-CTRecordingStorage { [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' )] [switch]$Enable, [Parameter( Mandatory=$false, ParameterSetName='All' )] [switch]$Overwrite, [Parameter( Mandatory=$false, ParameterSetName='All' )] [switch]$AutoDeleteEnable, [Parameter( Mandatory=$false, ParameterSetName='All' )] [int]$RetentionPeriod ) DynamicParam { $DynamicParameters = @{ CameraType = @{ Mandatory = $true Position = 1 ParameterSetName = "All" Enum = $Script:SupportedCameraModels } } return New-DynamicParameterSet -ParameterTable $DynamicParameters } Begin { Write-Debug "[Set-CTRecordingStorage] Started" $CameraType = $PSBoundParameters.CameraType if($CameraType -eq 'Hanwha') { #Set basic Paramters for Invoke-HanwhaCommand $CamCmd = @{ Arguments = @{ IP = $IP Menu = 'recording' SubMenu = 'storage' Action = 'set' Parameters = @() } Credential = $Credential } #Add Action Parameters if($Enable) { $CamCmd.Arguments.Parameters += "Enable=$Enable" } if($Overwrite) { $CamCmd.Arguments.Parameters += "OverWrite=$Overwrite" } if($AutoDeleteEnable) { $CamCmd.Arguments.Parameters += "AutoDeleteEnable=$AutoDeleteEnable" } if($RetentionPeriod) { $CamCmd.Arguments.Parameters += "AutoDeleteDays=$RetentionPeriod" } Invoke-HanwhaCommand @CamCmd } } } |