1

How to remove the Central Admin web app from IIS?

I am using SharePoint 2010 on Windows Server 2012.


I know I can remove an app with the SharePoint 2010 Management Shell by issuing:

Remove-SPWebApplication –identity http://sitename -Confirm

but when I replace http://sitename with the URL to the Central Admin web app http://myserver:46828 I am told: Cannot find an SPWebApplication object with Name, Id, or Url: http://myserver:46828.

3
  • 1
    Why would you want to remove THAT?? That's a weird question.
    – bgmCoder
    May 1 '13 at 2:26
  • @BGM: I was told to do this, if I understood well it is the first step described in this answer: sharepoint.stackexchange.com/a/61066/14701 May 1 '13 at 2:46
  • Ah, so you are trying to uninstall Sharepoint Server so you can reinstall it afresh?
    – bgmCoder
    May 1 '13 at 14:25
2

If you want to remove Central Administration, you can use this script:

Write-Host "Removing central administrations:"
$applications = Get-SPWebApplication -IncludeCentralAdministration | where-object {$_.IsAdministrationWebApplication -eq $true }
if($applications -eq $null)
{
    Write-Host "No central administrations found."
    return
}
foreach($application in $applications)
{
    Write-Host "$($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 
    Write-Host "`t removing iis site"
    $application.UnprovisionGlobally($true);

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

    $application.Delete();
 }
4
  • Thanks! Unfortunately I get An expression was expected after '('. for the final line. Adding a semicolon does not solve the problem either. Also, WriteFuncInfo has only 9 results on Google, and returns CommandNotFoundException. May 1 '13 at 8:18
  • 1
    Then replace them with Write-Host. May 1 '13 at 13:23
  • 1
    Write-Host solves the second problem. To solve the first problem, I just removed the function. Benny, I edit your solution to reflect what worked for me, OK? May 7 '13 at 5:16
  • @NicolasRaoul Great! Thanks for the team work! :-)
    – Benny Skogberg
    May 7 '13 at 9:50
1

If you want to remove or add Central Administration from/to IIS on specific hosts, just use

psconfig.exe -cmd adminvs -unprovision

or

psconfig.exe -cmd adminvs -provision

on these hosts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.