Private/Add-ADCCustomStoreFrontMonitor.ps1
function Add-ADCCustomStoreFrontMonitor { <# .SYNOPSIS Adds a Custom StoreFront Monitor to the Citrix ADC. .DESCRIPTION Adds a Custom StoreFront Monitor to the Citrix ADC. .PARAMETER Session The Citrix ADC Session to execute the function against. .PARAMETER MonitorName The Monitor Name. .PARAMETER StoreName The Citrix StoreFront Store Name to Monitor. .PARAMETER Secure Do you want to use SSL or HTTP to check the Store. .NOTES Creation Date: 20/06/2018 .CHANGE CONTROL Name Version Date Change Detail David Brett 1.0 29/03/2018 Function Creation .EXAMPLE Add-ADCCustomStoreFrontMonitor -MonitorName "mon_storefront_443" -StoreName "bretty" -Secure -Verbose #> [CmdletBinding()] Param ( $Session = $script:session, [parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName)] [string[]]$MonitorName = (Read-Host -Prompt 'Enter Custom TCP Monitor Name'), [string[]]$StoreName = (Read-Host -Prompt 'Enter StoreFront Store Name'), [Parameter(ValueFromPipeline)][switch]$Secure ) begin { if ($Secure) { $UseSecure = "yes" } else { $UseSecure = "no" } $PayLoad = @{ "monitorname" = $MonitorName "type" = "STOREFRONT" "storename" = $StoreName "secure" = $UseSecure } } process { try { Invoke-ADCRestAPI -Session $Session -Method POST -Type "lbmonitor" -Payload $PayLoad -Action Add write-verbose "Custom StoreFront Monitor ($MonitorName) added to the Citrix ADC monitoring $StoreName" } catch { write-verbose "Custom StoreFront Monitor ($MonitorName) could not be added to the Citrix ADC monitoring $StoreName" } } end { } } |