How do I reference environment variable in specific Resource Provider?


I’m trying to use Package provider and it has LogPath parameter, I’d like it to be pointing to $env:Temp variable. If I use it straight up on my authoring machine then it’s obviously expands this variable into local MOF file and hence it will fail in production.
So how do I instruct MOF file to use $env:Temp on machine MOF destined to be used on?

I think you’re asking how to setup a mof so it effectively contains a variable (in this case $env:temp) and thus pulls the correct value dynamically on the target machine and doesn’t actually pass the $env:temp on your authoring machine.

So I’ve only found two ways t do this personally:

  1. I ensure the module that will be generating these logs defaults to $env:temp so I don’t have to define it in my configuration. Sometimes it means a slight tweak, but that’s the joy of the modules being so accessible.

  2. I use the script resource to do said work. This way I can use setscript and it can contain whatever environment variables I want … it all runs on the client anyway.

I’m not aware of how to deliver a mof that contains variables outside of setscript. I’ve been proven wrong before, however, so I’m interested to see how others might handle this.