Not every farm is set up using SQL-Alias. It's not clear to me why this is so. Always. Use. SQL-Alias.
I've heard excuses like: "That's much more work". Yea. Like 5 clicks for each server. Granted.
But that got me thinking on how to automate the creation of SQL-Alias in a farm. I started out by wanting to utilize (Get-SPFarm).Servers
. However, the farm is only accessible after is is set up. That would be too late.
Therefore I created a script to set a SQL-Alias for a list of servers:
Consequently I also created a script to list the existing SQL-Alises: