The SMS MP for SCOM 2007 does not work properly if the SMS server is not installed to C:SMS

The SMS MP Guide actually tells you this:

"To specify the location of the SMS installation folder the script uses a system environment variable on the SMS site server. The administrator must create the %SMS_INSTALL_DIR_PATH% environment variable as a system environment variable so that the MOM Agent running under any user context has access to the log files. The script will then look in the %SMS_INSTALL_DIR_PATH%\Logs directory for the sender.log and distmgr.log files. For more information about setting system environment variables, see the system environment variable web page (< https://go.microsoft.com/fwlink/?LinkId=92316 >).
In order for the MOM Health Agent to use this system environment variable the SMS Site Server may need to be restarted."

This seems easy enough, but what if you have thousands of site servers?  My co-worker, Lenny Wile, ran into such a situation with a customer.  Obviously at this point we need an automated method of setting this environment variable.  Using SMS or SCOM a script such as this could be run on each site server to set the environment variable appropriately:

Set oWMI = GetObject("winMgmts:root\default:StdRegProv")
oWMI.GetStringValue &H80000002,"SOFTWARE\Microsoft\SMS\Setup","Installation Directory",sPath
Set oWMI = GetObject("winMgmts:root\cimv2:Win32_Environment")
Set oNewVar = oWMI.SpawnInstance_
oNewVar.UserName = "<SYSTEM>"
oNewVar.Name = "SMS_INSTALL_DIR_PATH"
oNewVar.VariableValue = sPath
oNewVar.Put_

For your reference, here is one of the errors you might see if this variable isn't set appropriately:

Error opening log file directory
Directory = %SMS_INSTALL_DIR_PATH%\Logs
Error: 0x80070003
Details: The system cannot find the path specified.
One or more workflows were affected by this.

Workflow name: SMS_2003_Component__The_sender_cannot_connect_to_remote_site_over_the_LAN__Advanced_Security__4_Rule
Instance name: Microsoft.SMS.2003.Microsoft_SMS_2003_Site_Servers_Installation
Instance ID: {34B6B4DF-3EF9-A320-7AD1-69EF7A68A288}