Public/Remove-P1ServerInstance.ps1
function Remove-P1ServerInstance { <# .Synopsis Uninstall a existing PlannerOne service. .Description Uninstall a existing PlannerOne service with the given parameters. .Parameter Tenant The tenant name of this service. .Example # Uninstall a PlannerOne service for the tenant Prod. Remove-P1ServerInstance -Tenant Prod #> [cmdletbinding()] param( [string] $Tenant ) Process { $serviceName = Get-ServiceNameFromTenant $Tenant $servicePath = Get-ServicePath #Test if service exists if (Test-ServiceExists($ServiceName)) { Stop-Service -Name $ServiceName Write-Output "Deleting PlannerOne service for Tenant $Tenant" Remove-Service($ServiceName) # Remove Service folder Write-Output "Removing folder: $servicePath\$Tenant" Remove-Symlink "$servicePath\$Tenant" } else { Write-Warning "Service $ServiceName doesn't exist!" } } } |