I need to capture the output created by a .bat file that is run from within a .ps1 file.
I'm new to powershell scripting but I know this isn't correct syntax. This best illustrates what I need to have happen.
I need to execute the facter.bat script then store its output in $Body
so I can use that text later.
"C:\Program Files (x86)\Puppet Labs\Puppet\bin\facter.bat" > $Body
This should do it:
$Body = & "C:\Program Files (x86)\Puppet Labs\Puppet\bin\facter.bat"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With