The following example can be used by managed service providers (MSPs) to create new customers and assign the appropriate security permissions and item creation rules:


  • The variables must be completed before running the script.

  • Configure the $serverUrl variable with the base URL of the server.

  • Configure the $customerName variable with the name of the customer. This must meet the configured customer item naming setting. This is used as the name of the customer in the user interface and in the item creation rule.

  • Configure the $customerAccountName variable with the Windows account name that will be assigned full permissions to this customer. This account must already exist and be in the format DOMAIN\Username.

  • Configure the $customerClientMachineName variable with the name of the computer running the XIA Configuration Client at the customer site. This is used by the item creation rule to ensure that items belonging to this customer are created in the correct customer container.



Code Sample


# Variables

$serverUrl = "http://localhost/xiaconfiguration"

$customerName = "NewCustomer"

$customerAccountName = "DEMONSTRATION\Administrator"

$customerClientMachineName = "CORP-SRV01"



# Connect to the server

Clear-Host

Write-Host "Connecting to XIA Server at" $serverUrl

$xiaUrl = $serverUrl + "/webservice/xiaconfiguration.asmx"

$coreUrl = $serverUrl + "/webservice/xiacore.asmx"

$xia = New-WebServiceProxy -UseDefaultCredential -Uri $xiaUrl

$xiaCore = New-WebServiceProxy -UseDefaultCredential -Uri $coreUrl

Write-Host "Connected as" $xia.WhoAmI()



# Create the customer container

$newCustomerID = $xia.DO_CreateItem($customerName, "Customer", 1000);

Write-Host "Created customer with identifier" $newCustomerID



# Set security on the container

$xia.DO_ReplaceItemOwnership($newCustomerID, $customerAccountName)



# Add a new item creation rule

$xiaCore.DO_CreateComputerBasedItemCreationRule($customerName, $newCustomerID, $customerClientMachineName)

Write-Host "Created item creation rule" $customerName