Quantcast
Channel: UC Geek - Lync and Skype for Business Specialist
Viewing all articles
Browse latest Browse all 116

Barracuda API - Creating a new domain using PowerShell

$
0
0
There are very little working examples of how to use the Barracuda API. Here's how you can create a new domain using PowerShell:

$URL = "https://barracudaurl.com/cgi-mod/api.cgi?password=123"
$DomainName = "domain.com"
$Xml = "<methodCall>
  <methodName>domain.add</methodName>
  <params>
    <param>
      <value>
        <struct>
          <member>
            <name>domain</name>
            <value>
              <string><![CDATA[$DomainName]]></string>
            </value>
          </member>
        </struct>
      </value>
    </param>
  </params>
</methodCall>"
$http_request = New-Object -ComObject Msxml2.XMLHTTP
$http_request.open('POST', $URL, $false)
$http_request.setRequestHeader("Content-type", "text/xml")
$http_request.setRequestHeader("Content-length", $Xml.length)
$http_request.setRequestHeader("Connection", "close")
$http_request.send($Xml)
$http_request.statusText
$http_request.responseText

I'll be adding an example of how to set the the domain properties next.

Viewing all articles
Browse latest Browse all 116

Trending Articles