New-AutoAttendant.ps1
<#PSScriptInfo
.VERSION 1.0.1 .GUID e58e126c-3e8a-4a98-bc80-d30c98a33978 .AUTHOR Aaron Guilmette .COMPANYNAME Microsoft .COPYRIGHT 2021 .TAGS New Auto Attendant .LICENSEURI .PROJECTURI .ICONURI .EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES .DESCRIPTION Create new auto attendant .PRIVATEDATA #> # Create a new auto-attendant # New-AutoAttendant # aaron.guilmette@microsoft.com # Build dynamic parameter for Policy name based on values in tenant [CmdletBinding()] Param ( $OperatorURI ) DynamicParam { $RuntimeParameterDictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary ## Available numbers $ParamName_LineUri = 'LineUri' $AttributeCollection = New-Object System.Collections.ObjectModel.Collection[System.Attribute] $ParameterAttribute = New-Object System.Management.Automation.ParameterAttribute $ParameterAttribute.Mandatory = $true $ParameterAttribute.Position = 1 $AttributeCollection.Add($ParameterAttribute) $arrSet = Get-CsOnlineTelephoneNumber -IsNotAssigned | Select -ExpandProperty Id $ValidateSetAttribute = New-Object System.Management.Automation.ValidateSetAttribute($arrSet) $AttributeCollection.Add($ValidateSetAttribute) $RuntimeParameter = New-Object System.Management.Automation.RuntimeDefinedParameter($ParamName_LineUri, [string], $AttributeCollection) $RuntimeParameterDictionary.Add($ParamName_LineUri, $RuntimeParameter) ## Time Zone $ParamName_TimeZone = 'TimeZone' $AttributeCollection = New-Object System.Collections.ObjectModel.Collection[System.Attribute] $ParameterAttribute = New-Object System.Management.Automation.ParameterAttribute $ParameterAttribute.Mandatory = $true $ParameterAttribute.Position = 2 $AttributeCollection.Add($ParameterAttribute) $arrSet = Get-CsOrganizationalAutoAttendantSupportedTimeZone | Select -ExpandProperty Id $ValidateSetAttribute = New-Object System.Management.Automation.ValidateSetAttribute($arrSet) $AttributeCollection.Add($ValidateSetAttribute) $RuntimeParameter = New-Object System.Management.Automation.RuntimeDefinedParameter($ParamName_TimeZone, [string], $AttributeCollection) $RuntimeParameterDictionary.Add($ParamName_TimeZone, $RuntimeParameter) return $RuntimeParameterDictionary } begin { } process { $LineNumber = [System.Uri]"tel:$PSBoundParameters[$LineUri]" $OperatorURI = "sip:$($OperatorURI)" $Timezone = $PSBoundParameters[$TimeZone] #$portgroup = $PsBoundParameters[$portgroup] #$datastore = $PsBoundParameters[$datastore] Write-Host Line is $LineNumber Write-Host Operator i $OperatorURI } end { } |