SharePoint: Update Service application name

I had a requirement to update the name of SharePoint Managed MetataData Service and its proxy in SharePoint farm. Since there is no way to do it in Central administration UI, I had to do it in PowerShell. The name of the service was "Managed Metadata Service Application" and the name of proxy was "MMS Proxy". The new name for service and proxy had to be similar and should be "Managed Metadata Service".

The Get-SPServiceApplication PowerShell command can be used to get hold of the service application and update its name.
$Service = Get-SPServiceApplication -Name "Managed Metadata Service Application"
$Proxy = Get-SPServiceApplicationProxy | ? {$_.Name -eq "MMS Proxy"} 
$Service.Name = "Managed Metadata Service" 
$Proxy.Name = "Managed Metadata Service"