• As you said in the article, enable xp_cmdshell is not the best option and a solution would be to create a CLR function to get the uptime.

    But, as the uptime it has nothing to do with SQL Server, because it's a Windows "function", it might be a good idea to get the information using a PowerShell script.