cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
463
Views
0
Helpful
1
Replies

DoSyncLdap axl powershell

I am trying to clean up my code a bit and im trying to make a class of sort to be called with other functions. Here is the code:

Function Invoke-SoapRequest {


    param(
        [parameter(Mandatory)]$Body,
        [parameter(Mandatory)]$MethodName
    )
    

$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("SOAPAction", "CUCM:DB ver=10.5 $MethodName")
$headers.Add("Content-Type", "text/xml; charset=utf-8")
$headers.Add("Acc", "text/xml")
$headers.Add("Authorization", "Basic nonubusiness")

[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true};

Invoke-RestMethod 'https://cucm/axl/' -Method 'POST' -Headers $headers -credential $pscred 


}

function Sync-LDAP
{
    $AXL = @"

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/10.5/">
        <soapenv:Header/>
            <soapenv:Body>
                <ns:doLdapSync>
                <name>LDAP</name>
                <sync>true</sync>
                </ns:doLdapSync>
            </soapenv:Body>
    </soapenv:Envelope>

"@

Invoke-SoapRequest -Body $AXL -MethodName doLdapSync
} 
Sync-LDAP

In my mind this should work as intended, but the powershell command is get malformed or something and this is not working at all. Any assistance would be appreicated.

1 Reply 1

Alex Stevenson
Cisco Employee
Cisco Employee

Hi @danielmcgovern23187,

 

          I found a relevant discussion here on the forums regarding AXL, CUCM and doLdapSync:

Trigger LDAP sync via AXL API in CUCM 10

 

          Also:

All Search Results for 'doLdapSync' on these Cisco Community Forums