0
I want the remote script in a given condition to end with error and exit as Failure.
if (($siteExists -eq $null) -and ($siteExistsInRecycleBin -eq $null)) {
write-output "info: Creating $($SiteCompleto)"
New-SPOSite -Url $SiteCompleto -title $TituloFinal -Owner $Proprietario -StorageQuota '5' -NoWait -ResourceQuota '100' -Template 'STS#0'
}
elseif ($siteExists -eq $true){
write-output "info: $($SiteCompleto) already exists"
stop
}
else{
write-output "info: $($SiteCompleto) still exists in the recyclebin"
stop
I need that in case the Sharepoint site already exists that the script is stopped and exit as if there was an error of execution, something similar to Kill -9 of the linux scripts. I am running this script remotely through an orchestrator who only handles Success or Failure.
As the stop command does not exist, the effect when I use it the result is what I want, abort the script with error, but actually the code is wrong and is not elegant at all the solution
Welcome to the site. You can edit the question and explain in more detail what you intend to do with this code?
– user28595
I need that in case the Sharepoint site already exists that the script is stopped and exit as if there was an error of execution, something similar to Kill -9 of the linux scripts. I am running this script remotely through an orchestrator who only handles Success or Failure
– claudio.aguiar
Claudio, click EDIT and add this explanation to the question :)
– user28595