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
}
}
I found solution, below method that I’m using now:
This solution based on original code from a ‘Remove-SPWebApplication’ cmdlet. It can be founded in Microsoft.SharePoint.PowerShell.dll SPCmdletRemoveSPWebApplication.