Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
1  
Why would you want to remove THAT?? That's a weird question. –  BGM 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 –  Nicolas Raoul May 1 '13 at 2:46
    
Ah, so you are trying to uninstall Sharepoint Server so you can reinstall it afresh? –  BGM May 1 '13 at 14:25

2 Answers 2

up vote 1 down vote accepted

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();
 }
share|improve this answer
    
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. –  Nicolas Raoul May 1 '13 at 8:18
1  
Then replace them with Write-Host. –  Robert Lindgren 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? –  Nicolas Raoul May 7 '13 at 5:16
    
@NicolasRaoul Great! Thanks for the team work! :-) –  Benny Skogberg MCSA May 7 '13 at 9:50

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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