what is fact syntax in powershell scripts?

I've created a few custom fax that I've verified are working on my windows client by using the facter -p command. However, I'm trying to use these facts inside a module using the exec command with the powershell provider. However, it doesn't appear that my powershell is able to read the facts. See example below:

myfact="hello" exec { 'mytest': command => 'add-content -path c:\mytest.txt -value "this is my fact, $::myfact" ' provider = > powershell } In my text file I only get "this is my fact,".... The fact does not show up. Any help? edit retag close merge delete Comments${::myfact} (with curly brackets)?

( 2015-04-06 12:13:06 -0600 )edit

Sort by » oldest newest most voted

I see what I was doing wrong... I had single quoted my powershell line.. preventing puppet from interpolating it's variables... enclosing my powershell in double quotes and removing my single quotes did the trick... now, if someone could tell me what characters need to be escaped in an EXEC command line.. I'll will be set. Thanks Kai for your response..

more

Yeah, now I see it too. <pre><code> and line formatting/alignment would have made it more obvious.

( 2015-04-06 15:36:44 -0600 )edit