Creating Managed Customers
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.
# Set the variables.
$serverUrl = "http://localhost/xiaconfiguration";
$customerName = "NewCustomer";
$customerAccountName = "DEMONSTRATION\Administrator";
$customerClientMachineName = "CORP-SRV01";
# Connect to the server, both the configuration and administration web services are required.
Write-Host "Connecting to server $($serverUrl)";
$xiaUrl = $serverUrl + "/webservice/xiaconfiguration.asmx";
$administrationUrl = $serverUrl + "/webservice/administration.asmx";
$xia = New-WebServiceProxy -UseDefaultCredential -Uri $xiaUrl;
$administration = New-WebServiceProxy -UseDefaultCredential -Uri $administrationUrl;
Write-Host "Connected as" $xia.GET_AuthenticatedUserName();
# Create the customer container.
$newCustomerID = $xia.DO_CreateItem($customerName, "Customer", 1000);
Write-Host "Created customer with identifier" $newCustomerID;
# Set security on the container.
# Add a new item creation rule.
$administration.DO_CreateComputerBasedItemCreationRule($customerName, $newCustomerID, $customerClientMachineName);
Write-Host "Created item creation rule" $customerName;