public/Set-CTDateTime.ps1
Function Set-CTDateTime { [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]$NTPServers, [Parameter( Mandatory=$false #ParameterSetName='All' )] [switch]$DisableNTP ) DynamicParam { $DynamicParameters = @{ CameraType = @{ Mandatory = $true #Position = 1 #ParameterSetName = "All" Enum = $Script:SupportedCameraModels } TimeZone = @{ Mandatory = $false #Position = 2 #ParameterSetName = "All" Enum = $Script:HanwhaTimeZones.Keys Value = "UTC" } } return New-DynamicParameterSet -ParameterTable $DynamicParameters } Begin { Write-Debug "[Set-CTDateTime] Started" $CameraType = $PSBoundParameters.CameraType $TimeZone = $PSBoundParameters.TimeZone #Build Submission Object $obj = @{ IP = $IP Credential = $Credential TimeZone = $TimeZone NTPServers = $NTPServers DisableNTP = $DisableNTP } #Choose Camera Model Switch ($CameraType) { Hanwha { return Set-HanwhaDateTime -Object $obj } } } } |