Delete workspace tenants

As an admin it is possible to delete a workspace from your instance. You need to update the $hostname and $provisioningKey to own parameters. The Provisioningskey is known internally.

#Set TLS communication to only 1.2. Other is not supported. [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$hostName = 'DOMAIN' # Enter the hostname of the Workspace365, dont include https or the environment name.
$provisioningKey = 'KEY' # Enter the Provisioningskey which is located in the NDAW.HTML.Front.config
$environmentNameRaw = Read-Host -Prompt "Enter Environment Name"
$environmentName = $environmentNameRaw.ToLower() if (![string]::IsNullOrEmpty($environmentName)) { $confirmation = Read-Host -Prompt "Are you sure you want to delete the environment: $environmentName ?" if ($confirmation -eq "y" -or $confirmation -eq "Y" -or $confirmation -eq "Yes" -or $confirmation -eq "yes"){
Invoke-RestMethod -Method DELETE -Uri "https://$hostName/Provisioning/Environment/$environmentName/" -ContentType "application/json" -Header @{ 'ProvisioningKey' = $provisioningKey } -ErrorVariable RestError;
Write-Host "Succesfully deleted environment $environmentName" -ForegroundColor Green;
$HttpStatusCode = $RestError.ErrorRecord.Exception.Response.StatusCode.value__
$HttpStatusDescription = $RestError.ErrorRecord.Exception.Response.StatusDescription

Write-Host "Environment deletion failed with error code: $($HttpStatusCode) and error description: $($HttpStatusDescription)" -ForegroundColor Red;
} else {
Write-Host "Environment deletion of environment: $environmentName canceled" -ForegroundColor Yellow;
} }