WhatsApp: 0623684723

Delete workspace tenants

Follow

As an admin it is possible to delete a workspace from your instance. You need to update the $hostname and $provisioningKey to own parameters. You can find the $provisioningKey in: 

\inetpub\wwwroot\Workspace 365\Workspace 365\Configs\NDAW.Html.Front.config

As a partner you should be aware of your own hostname. Fill in the details in the script below and execute the .ps1 script.


#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 envinromnemt, dont include https.
$provisioningKey = 'GUID' # 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"){
Try
{
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;
}
catch
{
$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;
} }
Have more questions? Submit a request