Barracuda API – Creating a new domain using PowerShell

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.
Andrew Morpeth
Andrew Morpethhttps://ucgeek.co/author/amorpeth/
Andrew is a Modern Workplace Consultant specialising in Microsoft technologies based in Auckland, New Zealand; Andrew is a Director and Professional Services Manager at Lucidity Cloud Services and a Microsoft MVP.

Related Articles

2 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Andrew Morpeth
Andrew Morpethhttps://ucgeek.co/author/amorpeth/
Andrew is a Modern Workplace Consultant specialising in Microsoft technologies based in Auckland, New Zealand; Andrew is a Director and Professional Services Manager at Lucidity Cloud Services and a Microsoft MVP.

Latest Articles