Wednesday, September 21, 2011

Change SharePoint 2010 Central Administration port number:

How to change SharePoint 2010 Central Administration port number:

Use: Set-SPCentralAdministration (if using an allowed port)
Set-SpCentralAdministration -port 1024 iisreset #And use whatever port number you choose #Note: the above command will make changes to IIS as well
If your port is between 1023 and 32767 (and is not port 443), then that should do it for you. But if you are trying a port outside that range, continue reading...

Use: stsadm -o setadminport (if using a "blocked" port)

If you choose a port number outside the range of 1023 - 32767, you may get error. For example, I triedSet-SpCentralAdministration with port 81 and got an Invalid Port error.
Set-SPCentralAdministration : The pipeline has been stopped. At line:1 char:28 + set-spcentraladministration ====  -port 81     + CategoryInfo          : InvalidData: (Microsoft.Share...lAdministration:SPCmdletSetSPCentralAdministration) [Set    -SPCentralAdministration], PipelineStoppedException     + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletSetSPCentralAdministration   Set-SPCentralAdministration : Invalid Port At line:1 char:28 + set-spcentraladministration ==== -port 81     + CategoryInfo          : InvalidArgument: (81:Int32) [Set-SPCentralAdministration], InvalidOperationException     + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletSetSPCentralAdministration
The reason: Set-SpCentralAdministration blocks the following ports:
  • Lower than 1023
  • Higher than 32767
  • 443 (SSL)
Obviously, our chosen port 81 is below 1023, which explains it. I tried other port numbers and they did work. But I didn't want -those- port numbers... I wanted port 81. So... "if you have a port number you are trying to use and there's nobody else who can fix it..." Technet advises using:
stsadm -o setadminport -port 81 iisreset

Use: New-SpCentralAdministration (if using a "blocked" port and you skipped the section above this)

Before I found the Technet article above, I tried "New-SpCentralAdministration -port 81" just to see what would happen. Let me be clear: I'm not completely sure what happened when I ran this command. Evidently, whatever I expected to happen when I ran "Set-SpCentralAdministration" happened when I ran "New-SpCentralAdministration": It re-assigned the Central Administration port number and got rid of my old Central Administration site at the previous port. If you run this command, look under "Alternate Access Mappings." You'll see that it has created a 2nd Internal URL:
Internal URLZonePublic URL for Zone
*The URL with the 81 port number is the one created with New-SpCentralAdministration. I deleted the first row (the 448 row).

No comments:

Post a Comment

How to launch a document by clicking a link to the file?

Word: <a href='ms-word:ofe|u|path/to/web/word/document.docx'>Link to document</a> Excel: <a href='ms-excel:o...