Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $CUCM = "CUCM_SERVER_URL"
- $WSDLPath = "PATH_TO_WSDL_FILE\AXLAPI.wsdl"
- #
- $username = Read-Host "Username for CUCM"
- $password = Read-Host "Password for CUCM" -AsSecureString #| ConvertTo-SecureString -AsPlainText
- #This creates the translation from a secure string object in Powershell, to plain text for CUCM to authenticate the user.
- $password = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($password))
- $phoneToEdit = Read-Host "What phone would you like to update? Please enter its MAC Address now"
- # This is where your AXL request goes
- $AXL = New-WebServiceProxy -Uri $WSDLPath -Credential $username, $password
- $request = @"
- <?xml version="1.0" encoding="UTF-8"?>
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/10.0">
- <soapenv:Header/>
- <soapenv:Body>
- <ns:getPhone sequence="?">
- <name>$phoneToEdit</name>
- </ns:getPhone>
- </soapenv:Body>
- </soapenv:Envelope>
- "@
- # Required to ignore some HTTP errors
- [System.Net.ServicePointManager]::Expect100Continue = $false
- #Authorization for HTTP
- $header = @{"Authorization" = "Basic " + [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($username + ":" + $password))}
- # Reset $result in case Invoke-WebRequest errors
- $result = $null
- $result = Invoke-webRequest -Uri "https://$CUCM`:8443/axl/" -Headers $header -Method 'POST' -Body $request -ContentType "text\xml" -UseBasicParsing
- # Output result
- $result.Envelope.Body.getPhoneResponse.return.phone | Out-GridView
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement