Public/Tasks/Invoke-CreateHostHeadersTask.ps1
#Requires -Modules SitecoreInstallFramework Set-StrictMode -Version Latest Write-Verbose "Loading $($MyInvocation.MyCommand.Path)" function Invoke-CreateHostHeadersTask { [CmdletBinding(SupportsShouldProcess = $true)] Param( [Parameter(Mandatory = $true)] [hashtable[]]$HostHeaders ) Set-PSDebug -Strict $whatIfSetting = $PSBoundParameters -and $PSBoundParameters.ContainsKey('WhatIf') -and $PSBoundParameters['WhatIf'] $verboseSetting = $PSBoundParameters -and $PSBoundParameters.ContainsKey('Verbose') -and $PSBoundParameters['Verbose'] Write-Verbose "Host Headers: $(($hostHeaders | Format-List) | Out-String)" $HostHeaders | ForEach-Object { $hostName = $null $ipAddress = $null if ($_.ContainsKey('HostName')) { $hostName = $_.HostName } if ($_.ContainsKey('IPAddress')) { $ipAddress = $_.IPAddress } if ($hostName) { $hostHeaderParams = @{ Host = $hostName } if ($ipAddress) { $hostHeaderParams.IPAddress = $ipAddress } Invoke-HostHeaderTask @hostHeaderParams -Verbose:$verboseSetting -WhatIf:$whatIfSetting } } } Register-SitecoreInstallExtension -Command Invoke-CreateHostHeadersTask -As CreateHostHeaders -Type Task -Force Write-Verbose "Loaded $($MyInvocation.MyCommand.Path)" |