Forum Discussion

davidashworth's avatar
davidashworth
Copper Contributor
Jun 20, 2022

Updating an existing Auto Attendant

Hi all,

 

I have been looking and cant find specific help on this subject. Ive seen loads of posts to create new AA's but not really to change an existing one. The scenario is that i want to update the greeting which will be customer facing via a power app. I would be using PowerShell in the backend and this is the code i have so far:

 

 

 

 

$AutoAttendantID = "1b87d836-ba69-4da5-a6ef-c3874b28353d"
$AutoAttendant = Get-CsAutoAttendant -Identity "$AutoAttendantID"
$content = Get-Content "C:\temp\voice.wav" -Encoding byte -ReadCount 0
$GreetingAudioFile = Import-CsOnlineAudioFile -ApplicationId "OrgAutoAttendant" -FileName "voice.wav" -Content $content
$GreetingAudioFile
$WelcomePrompt = New-CsAutoAttendantPrompt -AudioFilePrompt $GreetingAudioFile
Set-CsAutoAttendant -Identity "$AutoAttendant"

 

 

 

 

I typically get this kind of response:

But no changes are made to the actual AA. Am i doing something wrong or is what im trying to do not yet supported?

 

Will it be simpler for my script to delete the existing AA and then create a new one?

 

Thanks,
David

  • davidashworth 

     

    This is a quick example i made, 

     

    $attendantName = 'AA_BV_01'
    $aa = Get-CsAutoAttendant -NameFilter $attendantName | Where-Object Name -eq $attendantName
    
    
    $content = Get-Content "C:\Message.wav" -Encoding byte -ReadCount 0
    $audioFile = Import-CsOnlineAudioFile -ApplicationId "OrgAutoAttendant" -FileName "Message.wav" -Content $content
    
    
    $greetingPrompt = New-CsAutoAttendantPrompt -AudioFilePrompt $audioFile
    
    $aa.DefaultCallFlow.Greetings=$greetingPrompt
    
    
    # save the config
    Set-CsAutoAttendant -Instance $aa

     

    The key is to save the changes to the $aa object

     

    s

    • davidashworth's avatar
      davidashworth
      Copper Contributor

      Hi AndresGorzelany ,

       

      Thanks for your reply. I had come across both of those articles yesterday so i have adjusted my script but its still not working. First i am running the required version

      I have then adjusted my script to the following:

      # get the AA details
      $attendantName = 'CRED POC AA'
      $aa = Get-CsAutoAttendant -NameFilter $attendantName | Where-Object Name -eq $attendantName
      # upload audio file
      $content = Get-Content "C:\Temp\Voice.wav" -Encoding byte -ReadCount 0
      $AudioFile = Import-CsOnlineAudioFile -ApplicationId "OrgAutoAttendant" -FileName "Voice.Wav" -Content $content
      $AudioFilePrompt = New-CsAutoAttendantPrompt -AudioFilePrompt $audioFile
      # save the config
      Set-CsAutoAttendant -Instance $aa

      but i get an error

      i get a different error if i use identity

      i have gone through it and cant see any typo's and i think the code is written correctly as per those articles but it still looks like i have something wrong?

       

      Thanks,
      David

      • AndresGorzelany's avatar
        AndresGorzelany
        MVP
        I don't understand why Instance is not being recognized for you as a parameter, what permissions do you have in the tenant?

Resources