<p>You can only insert the return into the mine.</p>

<p>Just specify the cmd.run (or possibly cmd.script) in your mine_functions and you will get the whole return back.</p>

<p>If you want to have a script that sets up extra config on the minion, I would recommend writing a custom grain.</p>

<p><a href="https://docs.saltstack.com/en/latest/topics/grains/#writing-grains" rel="nofollow noreferrer">https://docs.saltstack.com/en/latest/topics/grains/#writing-grains</a></p>

CC BY-SA 3.0
2017-05-23T22:32:13.933Z
2017-05-23T22:32:13.933Z
gtmanfred
<p>Say I have a Powershell script, named <code>test.ps1</code>, that has this:</p>

<pre><code>$VariableForPillar = 5 
</code></pre>

<p>I can call it from a Salt state with -</p>

<pre><code>test powershell run:
 cmd.run:
   - name: 'C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe  -ExecutionPolicy ByPass -File  d:/tmp/Powershell/test.ps1'
</code></pre>

<p>But what can I do to retrieve that value and insert it into a Pillar (or a Mine)?</p>

<configuration-management><windows><salt>
How to insert a minion Powershell variable into Salt Pillar or Mine?
Michael B
# How to insert a minion Powershell variable into Salt Pillar or Mine?

(Asked by: username_0 on 2017-05-09)

Say I have a Powershell script, named test.ps1, that has this:
$VariableForPillar = 5 

I can call it from a Salt state with -
test powershell run:
 cmd.run:
   - name: 'C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe  -ExecutionPolicy ByPass -File  d:/tmp/Powershell/test.ps1'

But what can I do to retrieve that value and insert it into a Pillar (or a Mine)?

**Tags:** configuration-management, windows, salt


---

## 1 answers

### Answer by username_1 on 2017-05-23. Score: 4 | Accepted answer

You can only insert the return into the mine.

Just specify the cmd.run (or possibly cmd.script) in your mine\_functions and you will get the whole return back.

If you want to have a script that sets up extra config on the minion, I would recommend writing a custom grain.

<https://docs.saltstack.com/en/latest/topics/grains/#writing-grains>


---

