Changing SQL Server Port with Powershell
The other week, we were fortunate to have Mark Broadbent (blog\twitter) as a guest speaker at the Leeds SQL Server User Group. he did a great presentation on using Windows Server Core and SQL Server. If you haven’t taken time to learn Powershell then this could be the best reason to do so. Of course if you are already have your own toolbox of Powershell scripts to administer SQL Server on other editions of Windows, moving to Windows Core will be a doddle!
I have previously posted blogs about stopping/starting SQL Server using Powershell, and also enabling protocols with a Powershell script so when Mark mentioned Powershell as one option to change the TCP/IP port for an SQL Server Instance I thought I would write my own.
I incorporated into the scripts a check to make sure the instigator was a “real administrator” and also to prompt the user to start/restart the SQL Server instance to allow the changes to take effect.
The script can be found here.