Showing results for 
Search instead for 
Did you mean: 

Getting error - PowerShell script to CUCM / AXL API automation

Chidananda S
Level 1
Level 1

I am trying to build a script using Cisco AXL API and PowerShell.
When i try to run the below command i am getting error.


Invoke-RestMethod -Method Post -Uri "https://$cucmServer`:8443/axl/" -Headers @{'Content-Type'='text/xml';'SOAPAction'='CUCM:DB ver=' + $version} -Body $body -Credential $cred

CUCM version - 11.5
PowerShell version - 5.1.19041.1320

any guidance would be very helpful

2 Replies 2

Cisco Employee
Cisco Employee

I suspect you're not using powershell for SOAP correctly.  It looks like you're trying to use REST to perform the SOAP operation.  Here are a couple pages that explain how to use Powershell for SOAP you might find useful:


Cisco Employee
Cisco Employee

From the error message, it seems that AXL is not seeing the Authorization header credentials, or perhaps they are the incorrect ones.  After double checking the username/password are correct, another issue I've seen is some HTTP libraries will not (by default) proactively send the Authorization header but rather wait for a 404 and then re-send the request including credentials.  Usually there is an option/setting that allows you to force sending credentials on the first try.

FWIW, this is a PS sample that worked as of CUCM v10.5 (Windows 7):

[System.Net.ServicePointManager]::Expect100Continue = $false

$os = Get-WmiObject win32_operatingsystem

$body = @'
<soapenv:Envelope xmlns:soapenv="" xmlns:ns="">
      <ns:doLdapSync sequence="1">

$pwd = ConvertTo-SecureString "ciscopsdt" -AsPlainText -Force
$cred = New-Object Management.Automation.PSCredential ('Administrator', $pwd)

$Result = Invoke-RestMethod -Method Post `
-ContentType "text/xml" -Body $body `
-Credential $cred `