Skip to content

Instantly share code, notes, and snippets.

@jhochwald
Last active January 23, 2020 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhochwald/7407bc208da4c68cb466ad911a1b68b7 to your computer and use it in GitHub Desktop.
Save jhochwald/7407bc208da4c68cb466ad911a1b68b7 to your computer and use it in GitHub Desktop.
Generate a Microsoft Teams Room (MTR) System configuration file
function New-MtrConfigrationFile
{
<#
.SYNOPSIS
Generate a Microsoft Teams Room (MTR) System configuration file
.DESCRIPTION
Generate a Microsoft Teams Room (MTR) System configuration file
.PARAMETER AutoScreenShare
If true, auto screen share is enabled.
.PARAMETER HideMeetingName
If true, meeting names are hidden.
.PARAMETER UserAccount
Container for credentials parameters. The sign in address, Exchange address, or email address are usually the same, such as RanierConf@contoso.com.
.PARAMETER IsTeamsDefaultClient
Is Microsoft Teams the Default for new Meetings
.PARAMETER BluetoothAdvertisementEnabled
Support local Bluetooth beakoning
.PARAMETER SkypeMeetingsEnabled
Support Skype for Business Meetings
.PARAMETER TeamsMeetingsEnabled
Support Microsoft Terams Meetings
.PARAMETER DualScreenMode
If true, dual screen mode is enabled. Otherwise the device uses single screen mode.
.PARAMETER SendLogs
Configure the "Give Feedback" and "Report Issue"
.PARAMETER Devices
The connected audio device names in the child elements are the same values listed in the Device Manager app.
The configuration can contain a device that does not presently exist on the system, such as an A/V device not currently connected to the console.
The configuration would be retained for the respective device.
.PARAMETER ThemeName
Used to identify the theme on the client. The Theme Name options are Default, one of the provided preset themes, or Custom.
Custom theme names always use the name Custom.
The client UI can be set at the console to the Default or one of the presets, but use of a custom theme must be set remotely by an Administrator.
Preset themes include:
Default
Blue Wave
Digital Forest
Dreamcatcher
Limeade
Pixel Perfect
Roadmap
Sunset
To disable the current theme, use "No Theme" for the ThemeName.
.PARAMETER SkypeSignInAddress
The sign in name for the Skype for Business or Teams device account.
.PARAMETER ExchangeAddress
The sign in name for the Exchange device account.
.PARAMETER ExchangeAddress
The domain and user name of the device, for example Seattle\RanierConf.
.PARAMETER Password
The password parameter is the same password used for the Skype for Business device account sign-in.
.PARAMETER ConfigureDomain
You can list several domains, separated by commas.
Use one long string here!!!
.PARAMETER EmailAddressForLogsAndFeedback
Sets an optional email address that logs can be sent to when the "Give Feedback" window appears.
.PARAMETER SendLogsAndFeedback
If true, logs are sent to the admin. If false, only feedback is sent to the admin (and not logs).
.PARAMETER MicrophoneForCommunication
Sets the microphone used as the recording device in a conference.
.PARAMETER SpeakerForCommunication
Device to be used as speaker for the conference. This setting is used to set the speaker device used in a call.
.PARAMETER DefaultSpeaker
Device to be used to play the audio from an HDMI ingest source.
.PARAMETER ContentCameraId
Define the instance path for the camera configured in room to share analog whiteboard content in a meeting.
See https://docs.microsoft.com/en-us/MicrosoftTeams/room-systems/xml-config-file#locate-the-content-camera-usb-instance-path
Please note: We replace "&" with "&amp;" for you!
Just use the String you copied from the Device Manager/Imaging devices/Properties/Details/Device instance path
.PARAMETER ContentCameraInverted
Specify if the content camera is physically installed upside down. For content cameras that support automatic rotation, specify false.
.PARAMETER ContentCameraEnhancement
When set to true (the default), the content camera image is digitally enhanced: the whiteboard edge is detected and an appropriate zoom is selected, ink lines are enhanced, and the person writing on the whiteboard is made transparent.
Set to false if you intend to send a raw video feed to meeting participants for spaces where a whiteboard is not drawn on with a pen and instead the camera is used to show sticky notes, posters, or other media.
.PARAMETER CustomThemeImageUrl
Required for a custom theme, use file name only.
.PARAMETER RedComponent
Represents the red color component.
.PARAMETER GreenComponent
Represents the green color component.
.PARAMETER BlueComponent
Represents the blue color component.
.EXAMPLE
PS C:\> New-MtrConfigrationFile -ThemeName Custom -CustomThemeImageUrl 'wallpaper.jpg' -RedComponent 100 -BlueComponent 100 -GreenComponent 100
Generate a Microsoft Teams Room (MTR) System configuration file with a custom wallpaper and color settings
.EXAMPLE
PS C:\> New-MtrConfigrationFile -Devices -MicrophoneForCommunication 'Microsoft LifeChat LX-6000' -SpeakerForCommunication 'Realtek High Definition Audio' -DefaultSpeaker 'Polycom CX5100' -ContentCameraId 'USB\VID_046D&PID_0843&amp;MI_00\7&17446CF2&0&0000' -ContentCameraInverted $false -ContentCameraEnhancement $true
Generate a Microsoft Teams Room (MTR) System configuration file with custom devices
.EXAMPLE
PS C:\> New-MtrConfigrationFile -UserAccount -SkypeSignInAddress 'RanierConf@contoso.com' -ExchangeAddress 'RanierConf@contoso.com' -DomainUsername 'Seattle\RanierConf' -Password 'password' -ConfigureDomain 'domain1, domain2'
Generate a Microsoft Teams Room (MTR) System configuration file with configured user information (Accounts)
.LINK
http://hochwald.net
.NOTES
Initial MTR function
The dynmic parameters still need some tweaks!
#>
[CmdletBinding(DefaultParameterSetName = 'Devices',
ConfirmImpact = 'None',
SupportsShouldProcess)]
param
(
[Parameter(ValueFromPipeline,
ValueFromPipelineByPropertyName)]
[Alias('MTRAutoScreenShare')]
[string]
$AutoScreenShare = $null,
[Parameter(ValueFromPipeline,
ValueFromPipelineByPropertyName)]
[Alias('MtrHideMeetingName')]
[string]
$HideMeetingName = $null,
[Parameter(ParameterSetName = 'UserAccount',
ValueFromPipeline,
ValueFromPipelineByPropertyName)]
[switch]
$UserAccount,
[Parameter(ValueFromPipeline,
ValueFromPipelineByPropertyName)]
[Alias('MtrIsTeamsDefaultClient')]
[string]
$IsTeamsDefaultClient = $null,
[Parameter(ValueFromPipeline,
ValueFromPipelineByPropertyName)]
[Alias('MtrBluetoothAdvertisementEnabled')]
[string]
$BluetoothAdvertisementEnabled = $null,
[Parameter(ValueFromPipeline,
ValueFromPipelineByPropertyName)]
[Alias('MtrSkypeMeetingsEnabled')]
[string]
$SkypeMeetingsEnabled = $null,
[Parameter(ValueFromPipeline,
ValueFromPipelineByPropertyName)]
[Alias('MtrTeamsMeetingsEnabled')]
[string]
$TeamsMeetingsEnabled = $null,
[Parameter(ValueFromPipeline,
ValueFromPipelineByPropertyName)]
[Alias('MtrDualScreenMode')]
[string]
$DualScreenMode = $null,
[Parameter(ParameterSetName = 'SendLogs',
ValueFromPipeline,
ValueFromPipelineByPropertyName)]
[Alias('MtrSendLogs')]
[switch]
$SendLogs,
[Parameter(ParameterSetName = 'Devices',
ValueFromPipeline,
ValueFromPipelineByPropertyName)]
[Alias('MtrDevices')]
[switch]
$Devices,
[Parameter(ParameterSetName = 'ThemeName',
ValueFromPipeline,
ValueFromPipelineByPropertyName)]
[ValidateSet('Default ', 'Blue Wave ', 'Digital Forest ', 'Dreamcatcher ', 'Limeade ', 'Pixel Perfect ', 'Roadmap ', 'Sunset', 'No Theme', 'Custom', IgnoreCase = $true)]
[Alias('MtrThemeName')]
[string]
$ThemeName,
[Parameter(ValueFromPipeline,
ValueFromPipelineByPropertyName)]
[Alias('MtrPath')]
[string]
$Path = '.'
)
dynamicparam
{
# Initial
$RuntimeParameterDictionary = (New-Object -TypeName System.Management.Automation.RuntimeDefinedParameterDictionary)
#region UserAccount
if ($PsCmdLet.ParameterSetName -eq 'UserAccount')
{
#region SkypeSignInAddress
$ParamName_SkypeSignInAddress = 'SkypeSignInAddress'
$AttributeCollection = (New-Object -TypeName System.Collections.ObjectModel.Collection[System.Attribute])
$ParameterAttribute = (New-Object -TypeName System.Management.Automation.ParameterAttribute)
$ParameterAttribute.Mandatory = $true
$ParameterAttribute.HelpMessage = 'The sign in name for the Skype for Business or Teams device account.'
$ParameterAttribute.ParameterSetName = 'UserAccount'
$AttributeCollection.Add($ParameterAttribute)
$RuntimeParameter = (New-Object -TypeName System.Management.Automation.RuntimeDefinedParameter -ArgumentList ($ParamName_SkypeSignInAddress, [string], $AttributeCollection))
$RuntimeParameterDictionary.Add($ParamName_SkypeSignInAddress, $RuntimeParameter)
#endregion SkypeSignInAddress
#region ExchangeAddress
$ParamName_ExchangeAddress = 'ExchangeAddress'
$AttributeCollection = (New-Object -TypeName System.Collections.ObjectModel.Collection[System.Attribute])
$ParameterAttribute = (New-Object -TypeName System.Management.Automation.ParameterAttribute)
$ParameterAttribute.Mandatory = $true
$ParameterAttribute.HelpMessage = 'The sign in name for the Exchange device account.'
$ParameterAttribute.ParameterSetName = 'UserAccount'
$AttributeCollection.Add($ParameterAttribute)
$RuntimeParameter = (New-Object -TypeName System.Management.Automation.RuntimeDefinedParameter -ArgumentList ($ParamName_ExchangeAddress, [string], $AttributeCollection))
$RuntimeParameterDictionary.Add($ParamName_ExchangeAddress, $RuntimeParameter)
#endregion ExchangeAddress
#region DomainUsername
$ParamName_DomainUsername = 'DomainUsername'
$AttributeCollection = (New-Object -TypeName System.Collections.ObjectModel.Collection[System.Attribute])
$ParameterAttribute = (New-Object -TypeName System.Management.Automation.ParameterAttribute)
$ParameterAttribute.Mandatory = $true
$ParameterAttribute.HelpMessage = 'The sign in name for the Exchange device account.'
$ParameterAttribute.ParameterSetName = 'UserAccount'
$AttributeCollection.Add($ParameterAttribute)
$RuntimeParameter = (New-Object -TypeName System.Management.Automation.RuntimeDefinedParameter -ArgumentList ($ParamName_DomainUsername, [string], $AttributeCollection))
$RuntimeParameterDictionary.Add($ParamName_DomainUsername, $RuntimeParameter)
#endregion DomainUsername
#region Password
$ParamName_Password = 'Password'
$AttributeCollection = (New-Object -TypeName System.Collections.ObjectModel.Collection[System.Attribute])
$ParameterAttribute = (New-Object -TypeName System.Management.Automation.ParameterAttribute)
$ParameterAttribute.Mandatory = $true
$ParameterAttribute.HelpMessage = 'The password parameter is the same password used for the Skype for Business device account sign-in.'
$ParameterAttribute.ParameterSetName = 'UserAccount'
$AttributeCollection.Add($ParameterAttribute)
$RuntimeParameter = (New-Object -TypeName System.Management.Automation.RuntimeDefinedParameter -ArgumentList ($ParamName_Password, [string], $AttributeCollection))
$RuntimeParameterDictionary.Add($ParamName_Password, $RuntimeParameter)
#endregion Password
#region ConfigureDomain
$ParamName_ConfigureDomain = 'ConfigureDomain'
$AttributeCollection = (New-Object -TypeName System.Collections.ObjectModel.Collection[System.Attribute])
$ParameterAttribute = (New-Object -TypeName System.Management.Automation.ParameterAttribute)
$ParameterAttribute.ParameterSetName = 'UserAccount'
$AttributeCollection.Add($ParameterAttribute)
$RuntimeParameter = (New-Object -TypeName System.Management.Automation.RuntimeDefinedParameter -ArgumentList ($ParamName_ConfigureDomain, [string], $AttributeCollection))
$RuntimeParameterDictionary.Add($ParamName_ConfigureDomain, $RuntimeParameter)
#endregion ConfigureDomain
}
#endregion UserAccount
#region SendLogs
if ($PsCmdLet.ParameterSetName -eq 'SendLogs')
{
#region EmailAddressForLogsAndFeedback
$ParamName_EmailAddressForLogsAndFeedback = 'EmailAddressForLogsAndFeedback'
$AttributeCollection = (New-Object -TypeName System.Collections.ObjectModel.Collection[System.Attribute])
$ParameterAttribute = (New-Object -TypeName System.Management.Automation.ParameterAttribute)
$ParameterAttribute.ParameterSetName = 'SendLogs'
$AttributeCollection.Add($ParameterAttribute)
$RuntimeParameter = (New-Object -TypeName System.Management.Automation.RuntimeDefinedParameter -ArgumentList ($ParamName_EmailAddressForLogsAndFeedback, [string], $AttributeCollection))
$RuntimeParameterDictionary.Add($ParamName_EmailAddressForLogsAndFeedback, $RuntimeParameter)
#endregion EmailAddressForLogsAndFeedback
#region SendLogsAndFeedback
$ParamName_SendLogsAndFeedback = 'SendLogsAndFeedback'
$AttributeCollection = (New-Object -TypeName System.Collections.ObjectModel.Collection[System.Attribute])
$ParameterAttribute = (New-Object -TypeName System.Management.Automation.ParameterAttribute)
$ParameterAttribute.ParameterSetName = 'SendLogs'
$AttributeCollection.Add($ParameterAttribute)
$RuntimeParameter = (New-Object -TypeName System.Management.Automation.RuntimeDefinedParameter -ArgumentList ($ParamName_SendLogsAndFeedback, [string], $AttributeCollection))
$RuntimeParameterDictionary.Add($ParamName_SendLogsAndFeedback, $RuntimeParameter)
#endregion SendLogsAndFeedback
}
#endregion SendLogs
#region Devices
if ($PsCmdLet.ParameterSetName -eq 'Devices')
{
#region MicrophoneForCommunication
$ParamName_MicrophoneForCommunication = 'MicrophoneForCommunication'
$AttributeCollection = (New-Object -TypeName System.Collections.ObjectModel.Collection[System.Attribute])
$ParameterAttribute = (New-Object -TypeName System.Management.Automation.ParameterAttribute)
$ParameterAttribute.ParameterSetName = 'Devices'
$AttributeCollection.Add($ParameterAttribute)
$RuntimeParameter = (New-Object -TypeName System.Management.Automation.RuntimeDefinedParameter -ArgumentList ($ParamName_MicrophoneForCommunication, [string], $AttributeCollection))
$RuntimeParameterDictionary.Add($ParamName_MicrophoneForCommunication, $RuntimeParameter)
#endregion MicrophoneForCommunication
#region SpeakerForCommunication
$ParamName_SpeakerForCommunication = 'SpeakerForCommunication'
$AttributeCollection = (New-Object -TypeName System.Collections.ObjectModel.Collection[System.Attribute])
$ParameterAttribute = (New-Object -TypeName System.Management.Automation.ParameterAttribute)
$AttributeCollection.Add($ParameterAttribute)
$RuntimeParameter = (New-Object -TypeName System.Management.Automation.RuntimeDefinedParameter -ArgumentList ($ParamName_SpeakerForCommunication, [string], $AttributeCollection))
$RuntimeParameterDictionary.Add($ParamName_SpeakerForCommunication, $RuntimeParameter)
#endregion SpeakerForCommunication
#region DefaultSpeaker
$ParamName_DefaultSpeaker = 'DefaultSpeaker'
$AttributeCollection = (New-Object -TypeName System.Collections.ObjectModel.Collection[System.Attribute])
$ParameterAttribute = (New-Object -TypeName System.Management.Automation.ParameterAttribute)
$AttributeCollection.Add($ParameterAttribute)
$RuntimeParameter = (New-Object -TypeName System.Management.Automation.RuntimeDefinedParameter -ArgumentList ($ParamName_DefaultSpeaker, [string], $AttributeCollection))
$RuntimeParameterDictionary.Add($ParamName_DefaultSpeaker, $RuntimeParameter)
#endregion DefaultSpeaker
#region ContentCameraId
$ParamName_ContentCameraId = 'ContentCameraId'
$AttributeCollection = (New-Object -TypeName System.Collections.ObjectModel.Collection[System.Attribute])
$ParameterAttribute = (New-Object -TypeName System.Management.Automation.ParameterAttribute)
$AttributeCollection.Add($ParameterAttribute)
$RuntimeParameter = (New-Object -TypeName System.Management.Automation.RuntimeDefinedParameter -ArgumentList ($ParamName_ContentCameraId, [string], $AttributeCollection))
$RuntimeParameterDictionary.Add($ParamName_ContentCameraId, $RuntimeParameter)
#endregion ContentCameraId
#region ContentCameraInverted
$ParamName_ContentCameraInverted = 'ContentCameraInverted'
$AttributeCollection = (New-Object -TypeName System.Collections.ObjectModel.Collection[System.Attribute])
$ParameterAttribute = (New-Object -TypeName System.Management.Automation.ParameterAttribute)
$AttributeCollection.Add($ParameterAttribute)
$RuntimeParameter = (New-Object -TypeName System.Management.Automation.RuntimeDefinedParameter -ArgumentList ($ParamName_ContentCameraInverted, [string], $AttributeCollection))
$RuntimeParameterDictionary.Add($ParamName_ContentCameraInverted, $RuntimeParameter)
#endregion ContentCameraInverted
#region ContentCameraEnhancement
$ParamName_ContentCameraEnhancement = 'ContentCameraEnhancement'
$AttributeCollection = (New-Object -TypeName System.Collections.ObjectModel.Collection[System.Attribute])
$ParameterAttribute = (New-Object -TypeName System.Management.Automation.ParameterAttribute)
$AttributeCollection.Add($ParameterAttribute)
$RuntimeParameter = (New-Object -TypeName System.Management.Automation.RuntimeDefinedParameter -ArgumentList ($ParamName_ContentCameraEnhancement, [string], $AttributeCollection))
$RuntimeParameterDictionary.Add($ParamName_ContentCameraEnhancement, $RuntimeParameter)
#endregion ContentCameraEnhancement
}
#endregion Devices
#region ThemeNameCustom
if (($PsCmdLet.ParameterSetName -eq 'ThemeName') -and ($ThemeName -eq 'Custom'))
{
#region CustomThemeImageUrl
$ParamName_CustomThemeImageUrl = 'CustomThemeImageUrl'
$AttributeCollection = (New-Object -TypeName System.Collections.ObjectModel.Collection[System.Attribute])
$ParameterAttribute = (New-Object -TypeName System.Management.Automation.ParameterAttribute)
$ParameterAttribute.Mandatory = $true
$ParameterAttribute.HelpMessage = 'Required for a custom theme, use file name only.'
$ParameterAttribute.ParameterSetName = 'ThemeName'
$AttributeCollection.Add($ParameterAttribute)
$RuntimeParameter = (New-Object -TypeName System.Management.Automation.RuntimeDefinedParameter -ArgumentList ($ParamName_CustomThemeImageUrl, [string], $AttributeCollection))
$RuntimeParameterDictionary.Add($ParamName_CustomThemeImageUrl, $RuntimeParameter)
#endregion CustomThemeImageUrl
#region RedComponent
$ParamName_RedComponent = 'RedComponent'
$AttributeCollection = (New-Object -TypeName System.Collections.ObjectModel.Collection[System.Attribute])
$ParameterAttribute = (New-Object -TypeName System.Management.Automation.ParameterAttribute)
$ParameterAttribute.ParameterSetName = 'ThemeName'
$AttributeCollection.Add($ParameterAttribute)
$RuntimeParameter = (New-Object -TypeName System.Management.Automation.RuntimeDefinedParameter -ArgumentList ($ParamName_RedComponent, [int], $AttributeCollection))
$RuntimeParameterDictionary.Add($ParamName_RedComponent, $RuntimeParameter)
#endregion RedComponent
#region GreenComponent
$ParamName_GreenComponent = 'GreenComponent'
$AttributeCollection = (New-Object -TypeName System.Collections.ObjectModel.Collection[System.Attribute])
$ParameterAttribute = (New-Object -TypeName System.Management.Automation.ParameterAttribute)
$ParameterAttribute.ParameterSetName = 'ThemeName'
$AttributeCollection.Add($ParameterAttribute)
$RuntimeParameter = (New-Object -TypeName System.Management.Automation.RuntimeDefinedParameter -ArgumentList ($ParamName_GreenComponent, [int], $AttributeCollection))
$RuntimeParameterDictionary.Add($ParamName_GreenComponent, $RuntimeParameter)
#endregion GreenComponent
#region BlueComponent
$ParamName_BlueComponent = 'BlueComponent'
$AttributeCollection = (New-Object -TypeName System.Collections.ObjectModel.Collection[System.Attribute])
$ParameterAttribute = (New-Object -TypeName System.Management.Automation.ParameterAttribute)
$ParameterAttribute.ParameterSetName = 'ThemeName'
$AttributeCollection.Add($ParameterAttribute)
$RuntimeParameter = (New-Object -TypeName System.Management.Automation.RuntimeDefinedParameter -ArgumentList ($ParamName_BlueComponent, [int], $AttributeCollection))
$RuntimeParameterDictionary.Add($ParamName_BlueComponent, $RuntimeParameter)
#endregion BlueComponent
}
#endregion ThemeNameCustom
# Dump all the dynamic parameters
return $RuntimeParameterDictionary
}
begin
{
#region SaveTheDynmicValues
#region SkypeSignInAddress
try
{
if ($PsBoundParameters[$ParamName_SkypeSignInAddress])
{
[string]$SkypeSignInAddress = $PsBoundParameters[$ParamName_SkypeSignInAddress]
}
}
catch
{
$SkypeSignInAddress = $null
}
#endregion SkypeSignInAddress
#region ExchangeAddress
try
{
if ($PsBoundParameters[$ParamName_ExchangeAddress])
{
[string]$ExchangeAddress = $PsBoundParameters[$ParamName_ExchangeAddress]
}
}
catch
{
$ExchangeAddress = $null
}
#endregion ExchangeAddress
#region DomainUsername
try
{
if ($PsBoundParameters[$ParamName_DomainUsername])
{
[string]$DomainUsername = $PsBoundParameters[$ParamName_DomainUsername]
}
}
catch
{
$DomainUsername = $null
}
#endregion DomainUsername
#region Password
try
{
if ($PsBoundParameters[$ParamName_Password])
{
[string]$Password = $PsBoundParameters[$ParamName_Password]
}
}
catch
{
$Password = $null
}
#endregion Password
#region ConfigureDomain
try
{
if ($PsBoundParameters[$ParamName_ConfigureDomain])
{
[string]$ConfigureDomain = $PsBoundParameters[$ParamName_ConfigureDomain]
}
}
catch
{
$ConfigureDomain = $null
}
#endregion ConfigureDomain
#region EmailAddressForLogsAndFeedback
try
{
if ($PsBoundParameters[$ParamName_EmailAddressForLogsAndFeedback])
{
[string]$EmailAddressForLogsAndFeedback = $PsBoundParameters[$ParamName_EmailAddressForLogsAndFeedback]
}
}
catch
{
$EmailAddressForLogsAndFeedback = $null
}
#endregion EmailAddressForLogsAndFeedback
#region SendLogsAndFeedback
try
{
if ($PsBoundParameters[$ParamName_SendLogsAndFeedback])
{
[bool]$SendLogsAndFeedback = $PsBoundParameters[$ParamName_SendLogsAndFeedback]
}
}
catch
{
$SendLogsAndFeedback = $null
}
#endregion SendLogsAndFeedback
#region MicrophoneForCommunication
try
{
if ($PsBoundParameters[$ParamName_MicrophoneForCommunication])
{
[string]$MicrophoneForCommunication = $PsBoundParameters[$ParamName_MicrophoneForCommunication]
}
}
catch
{
$MicrophoneForCommunication = $null
}
#endregion MicrophoneForCommunication
#region SpeakerForCommunication
try
{
if ($PsBoundParameters[$ParamName_SpeakerForCommunication])
{
[string]$SpeakerForCommunication = $PsBoundParameters[$ParamName_SpeakerForCommunication]
}
}
catch
{
$SpeakerForCommunication = $null
}
#endregion SpeakerForCommunication
#region DefaultSpeaker
try
{
if ($PsBoundParameters[$ParamName_DefaultSpeaker])
{
[string]$DefaultSpeaker = $PsBoundParameters[$ParamName_DefaultSpeaker]
}
}
catch
{
$DefaultSpeaker = $null
}
#endregion DefaultSpeaker
#region ContentCameraId
try
{
if ($PsBoundParameters[$ParamName_ContentCameraId])
{
[string]$ContentCameraId = $PsBoundParameters[$ParamName_ContentCameraId]
# Replace the ampersand (&) with &amp;
[string]$ContentCameraId = [string]$ContentCameraId.Replace('&', '&amp;')
}
}
catch
{
$ContentCameraId = $null
}
#endregion ContentCameraId
#region ContentCameraInverted
try
{
if ($PsBoundParameters[$ParamName_ContentCameraInverted])
{
[bool]$ContentCameraInverted = $PsBoundParameters[$ParamName_ContentCameraInverted]
}
}
catch
{
$ContentCameraInverted = $null
}
#endregion ContentCameraInverted
#region ContentCameraEnhancement
try
{
if ($PsBoundParameters[$ParamName_ContentCameraEnhancement])
{
[bool]$ContentCameraEnhancement = $PsBoundParameters[$ParamName_ContentCameraEnhancement]
}
}
catch
{
$ContentCameraEnhancement = $null
}
#endregion ContentCameraEnhancement
#region CustomThemeImageUrl
try
{
if ($PsBoundParameters[$ParamName_CustomThemeImageUrl])
{
[string]$CustomThemeImageUrl = $PsBoundParameters[$ParamName_CustomThemeImageUrl]
}
}
catch
{
$CustomThemeImageUrl = $null
}
#endregion CustomThemeImageUrl
#region RedComponent
try
{
if ($PsBoundParameters[$ParamName_RedComponent])
{
[int]$RedComponent = $PsBoundParameters[$ParamName_RedComponent]
# Check the values
if (($RedComponent -lt 0) -or ($RedComponent -gt 255))
{
Write-Error -Message ('The Value RedComponent is {0} - Valis is 0-255' -f $RedComponent) -Category InvalidArgument -TargetObject $RedComponent -ErrorAction Stop
# Just in case
exit 1
}
}
}
catch
{
$RedComponent = $null
}
#endregion RedComponent
#region GreenComponent
try
{
if ($PsBoundParameters[$ParamName_GreenComponent])
{
[int]$GreenComponent = $PsBoundParameters[$ParamName_GreenComponent]
# Check the values
if (($GreenComponent -lt 0) -or ($GreenComponent -gt 255))
{
Write-Error -Message ('The Value GreenComponent is {0} - Valis is 0-255' -f $GreenComponent) -Category InvalidArgument -TargetObject $GreenComponent -ErrorAction Stop
# Just in case
exit 1
}
}
}
catch
{
$GreenComponent = $null
}
#endregion GreenComponent
#region BlueComponent
try
{
if ($PsBoundParameters[$ParamName_BlueComponent])
{
[int]$BlueComponent = $PsBoundParameters[$ParamName_BlueComponent]
# Check the values
if (($BlueComponent -lt 0) -or ($BlueComponent -gt 255))
{
Write-Error -Message ('The Value BlueComponent is {0} - Valis is 0-255' -f $BlueComponent) -Category InvalidArgument -TargetObject $BlueComponent -ErrorAction Stop
# Just in case
exit 1
}
}
}
catch
{
$BlueComponent = $null
}
#endregion BlueComponent
#endregion SaveTheDynmicValues
}
process
{
if (($AutoScreenShare) -or ($HideMeetingName) -or ($UserAccount) -or ($IsTeamsDefaultClient) -or ($BluetoothAdvertisementEnabled) -or ($SkypeMeetingsEnabled) -or ($TeamsMeetingsEnabled) -or ($DualScreenMode) -or ($SendLogs) -or ($Devices) -or ($ThemeName))
{
#region SomeCheck
if (($SkypeMeetingsEnabled) -and ($TeamsMeetingsEnabled))
{
if (($SkypeMeetingsEnabled -eq [bool]$false) -and ($TeamsMeetingsEnabled -eq [bool]$false))
{
Write-Error -Message 'The XML file is considered badly formed if both <SkypeMeetingsEnabled> and<TeamsMeetingsEnabled> are disabled, but it is acceptable to have both settings enabled at the same time.' -Category InvalidData -ErrorAction Stop
}
}
#endregion SomeCheck
try
{
# Create the Settings name
[string]$SkypeSettingsName = 'SkypeSettings.xml'
# Create the XML configuration file
$paramNewObject = @{
TypeName = 'System.XMl.XmlTextWriter'
ArgumentList = (($Path + '\' + $SkypeSettingsName), $null)
}
$xmlWriter = (New-Object @paramNewObject)
# Set the defaults for the XML configuration file
$xmlWriter.Formatting = 'Indented'
$xmlWriter.Indentation = 1
$xmlWriter.IndentChar = "`t"
# Create the document
$xmlWriter.WriteStartDocument()
# Create <SkypeSettings>
$xmlWriter.WriteStartElement('SkypeSettings')
if ($AutoScreenShare)
{
$xmlWriter.WriteElementString('AutoScreenShare', $AutoScreenShare)
}
if ($HideMeetingName)
{
$xmlWriter.WriteElementString('HideMeetingName', $HideMeetingName)
}
if ($UserAccount)
{
# Create <UserAccount>
$xmlWriter.WriteStartElement('UserAccount')
if ($SkypeSignInAddress)
{
$xmlWriter.WriteElementString('SkypeSignInAddress', $SkypeSignInAddress)
}
if ($ExchangeAddress)
{
$xmlWriter.WriteElementString('ExchangeAddress', $ExchangeAddress)
}
if ($DomainUsername)
{
$xmlWriter.WriteElementString('DomainUsername', $DomainUsername)
}
if ($Password)
{
$xmlWriter.WriteElementString('Password', $Password)
}
if ($ConfigureDomain)
{
$xmlWriter.WriteElementString('ConfigureDomain', $ConfigureDomain)
}
# Close </UserAccount>
$xmlWriter.WriteEndElement()
}
if ($IsTeamsDefaultClient)
{
$xmlWriter.WriteElementString('IsTeamsDefaultClient', $IsTeamsDefaultClient)
}
if ($BluetoothAdvertisementEnabled)
{
$xmlWriter.WriteElementString('BluetoothAdvertisementEnabled', $BluetoothAdvertisementEnabled)
}
if ($SkypeMeetingsEnabled)
{
$xmlWriter.WriteElementString('SkypeMeetingsEnabled', $SkypeMeetingsEnabled)
}
if ($TeamsMeetingsEnabled)
{
$xmlWriter.WriteElementString('TeamsMeetingsEnabled', $TeamsMeetingsEnabled)
}
if ($DualScreenMode)
{
$xmlWriter.WriteElementString('DualScreenMode', $DualScreenMode)
}
if ($SendLogs)
{
# Create <SendLogs>
$xmlWriter.WriteStartElement('SendLogs')
if ($EmailAddressForLogsAndFeedback)
{
$xmlWriter.WriteElementString('EmailAddressForLogsAndFeedback', $EmailAddressForLogsAndFeedback)
}
if ($SendLogsAndFeedback)
{
$xmlWriter.WriteElementString('SendLogsAndFeedback', $SendLogsAndFeedback)
}
# Close </SendLogs>
$xmlWriter.WriteEndElement()
}
if ($Devices)
{
# Create <Devices>
$xmlWriter.WriteStartElement('Devices')
if ($MicrophoneForCommunication)
{
$xmlWriter.WriteElementString('MicrophoneForCommunication', $MicrophoneForCommunication)
}
if ($SpeakerForCommunication)
{
$xmlWriter.WriteElementString('SpeakerForCommunication', $SpeakerForCommunication)
}
if ($DefaultSpeaker)
{
$xmlWriter.WriteElementString('DefaultSpeaker', $DefaultSpeaker)
}
if ($ContentCameraId)
{
$xmlWriter.WriteElementString('ContentCameraId', $ContentCameraId)
}
if ($ContentCameraInverted)
{
$xmlWriter.WriteElementString('ContentCameraInverted', $ContentCameraInverted)
}
if ($ContentCameraEnhancement)
{
$xmlWriter.WriteElementString('ContentCameraEnhancement', $ContentCameraEnhancement)
}
# Close </Devices>
$xmlWriter.WriteEndElement()
}
if ($ThemeName)
{
# Create <Theming>
$xmlWriter.WriteStartElement('Theming')
if ($ThemeName)
{
$xmlWriter.WriteElementString('ThemeName', $ThemeName)
}
if ($CustomThemeImageUrl)
{
$xmlWriter.WriteElementString('CustomThemeImageUrl', $CustomThemeImageUrl)
}
if (($RedComponent) -or ($GreenComponent) -or ($BlueComponent))
{
# Create <CustomThemeColor>
$xmlWriter.WriteStartElement('CustomThemeColor')
if ($RedComponent)
{
$xmlWriter.WriteElementString('RedComponent', $RedComponent)
}
if ($GreenComponent)
{
$xmlWriter.WriteElementString('GreenComponent', $GreenComponent)
}
if ($BlueComponent)
{
$xmlWriter.WriteElementString('BlueComponent', $BlueComponent)
}
# Close </CustomThemeColor>
$xmlWriter.WriteEndElement()
}
# Close </Theming>
$xmlWriter.WriteEndElement()
}
# Close </SkypeSettings>
$xmlWriter.WriteEndElement()
# Save the XML
$xmlWriter.WriteEndDocument()
$xmlWriter.Flush()
$xmlWriter.Close()
}
catch
{
#region ErrorHandler
# get error record
[Management.Automation.ErrorRecord]$e = $_
# retrieve information about runtime error
$info = [PSCustomObject]@{
Exception = $e.Exception.Message
Reason = $e.CategoryInfo.Reason
Target = $e.CategoryInfo.TargetName
Script = $e.InvocationInfo.ScriptName
Line = $e.InvocationInfo.ScriptLineNumber
Column = $e.InvocationInfo.OffsetInLine
}
$info | Out-String | Write-Verbose
Write-Error -Message ($info.Exception) -Exception ($e.Exception) -ErrorAction Stop -WarningAction Continue
#endregion ErrorHandler
}
}
else
{
Write-Verbose 'Nothing to do!!!'
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment