Jul 28 2021 07:10 AM
Hello,
I want to make a script where i can import a .csv file with multiple users and numbers.
The original script is=
Set-CsUser -ID a.user@domain.com -OnPremLineURI tel:+31881234567 -EnterpriseVoiceEnabled $true -HostedVoiceMail $true
I tried to make a script, but it fails on:
Cannot bind parameter 'Identity'. Cannot convert value "System.Collections.Hashtable" to type "Microsoft.Rtc.Management.AD.UserIdParameter". Error: "Cannot convert hashtable to an object of the following type: Microsoft.Rtc.Management.AD.UserIdParameter. Ha
shtable-to-Object conversion is not supported in restricted language mode or a Data section."
The Script i tried to use is (I find one online and edit the script):
Import-Csv C:\path\file.csv -Delimiter ';'
ForEach-Object{
$paramsetcsuser = @{
Identity = $_.identity
EnterpriseVoiceEnabled = if($_.EnterpriseVoiceEnabled -eq 'true'){$true}else{$false}
HostedVoiceMail = if($_.HostedVoiceMail -eq 'true'){$true}else{$false}
OnPremLineURI = 'tel:' + $_.OnPremLineURI
UnknownParameter5 = '+'
UnknownParameter6 = $_.OnPremLineURI
}
Set-CsUser $paramsetcsuser
}
csv file i use:
Is there anyone that can help me with this?
Jul 28 2021 07:35 AM
Jul 28 2021 07:38 AM
Iam using the MicrosoftTeams module
Set-ExecutionPolicy unrestricted
Install-Module MicrosoftTeams -Force
Import-Module -Name MicrosoftTeams
#Connect to Microsoft Teams
Connect-MicrosoftTeams