• Apparently, you can use xp_instance_regread with keys that have spaces if you double up the backslash on the element that has spaces, e.g.:

    exec master.dbo.xp_instance_regread 'HKEY_LOCAL_MACHINE',

    'SOFTWARE\Microsoft\\Microsoft SQL Server\FXOTDBSQL\MSSQLServer\SuperSocketNetLib\Tcp', 'TcpPort', @port OUTPUT

    Notice the doubled-up backslash before "Microsoft SQL Server".