Sharepoint: ¿Cómo eliminar la aplicación web de administración central sin confirmación?

I wonder how I could delete central administration web application without confirmation in powershell? Script that I'm using (now all web application removed without confiramtion, only central administration web app requests it). Thanks in advance.

function RemoveWebApplications()
{
    WriteFuncInfo "Removing all web applications..."

    $applications = Get-SPWebApplication -IncludeCentralAdministration
    if($applications -eq $null)
    {
        WriteFuncInfo "No web applications found."
        return
    }
    WriteFuncInfo "Removing web applications $($applications.Count):"

    foreach($application in $applications)
    {
        WriteFuncInfo "$($application.Name) with database and iis site"
        Remove-SPWebApplication $application -DeleteIISSite -RemoveContentDatabases -Confirm:$false  
    }   
}    

preguntado el 31 de julio de 12 a las 11:07

1 Respuestas

I found solution, below method that I'm using now:

function RemoveCentralAdministration()
{
    WriteFuncInfo "Removing central administrations:"
    $applications = Get-SPWebApplication -IncludeCentralAdministration | where-object {$_.IsAdministrationWebApplication -eq $true }
    if($applications -eq $null)
    {
        WriteFuncInfo "No central administrations found."
        return
    }
    foreach($application in $applications)
    {
        WriteFuncInfo "$($application.Url)"

        # for central administration web application Remove-SPWebApplication cmdlet requests confiramtion
        # even if parameter '-Confirm:$false' is used

        # Remove-SPWebApplication $application -DeleteIISSite -RemoveContentDatabases -Confirm:$false 
        WriteFuncInfo "`t removing iis site"
        $application.UnprovisionGlobally($true);

        WriteFuncInfo "`t removing databases"
        foreach ($contentDb in $application.ContentDatabases)
        {
            $contentDb.Unprovision();
        }

        $application.Delete();
     }    
}

This solution based on original code from a 'Remove-SPWebApplication' cmdlet. It can be founded in Microsoft.SharePoint.PowerShell.dll SPCmdletRemoveSPWebApplication.

Respondido 02 ago 12, 06:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.