Source: SCOMNIVORE at myITforum.com
Vin DiPippo has written a great article about about some important concepts regarding how scripts are processed by OpsMgr.
“Returning to the main topic, anyone that is a script developer has a particular paradigm in mind. The script is written and runs as written. If you've ever seen constructions that use the $...$ selectors inline (e.g. SomeVar = "$MPElement...$"), you might have assumed that there was something special about the script execution environment that somehow resolves those. The reality is that those resolutions are done before the script is ever executed. Therefore, we have a very tricky paradigm on our hands: the execution environment is completely standard, but the script body itself is "refined" by OpsMgr before it is embodied in an actual file and run. “
All together a great article that I’ve put in in my OneNote OpsMgr KB articles Notebook. As you should do too!