Ask Your Question
0

Powershell and Transcript

asked 2014-03-25 22:10:34 -0600

dancewind gravatar image

We would like to use puppet exec to execute a powershell script as bellow.

exec {"powershell -executionpolicy remotesigned -file ${app_dir}/Deploy/0.Prod.Deploy.ps1" :
            path => 'C:/Windows/System32/WindowsPowerShell/v1.0',
            cwd => "${app_dir}/Deploy",
            refreshonly => true,
            require => File["${app_dir}/WebSite" ],
    }

Before, we use the script below to log the output :

.\1.SIT.Copy.ps1|Out-File .\DeployOutput.txt

When doing "puppet agent --test", this will successfully log the output to DeployOutput.txt.

However, this does not support the error message during executing the script.

Instead, we tried using Transcript to log the executing process:

 Start-Transcript -path ".\DeployOutput.txt" -Force
 .\1 ...
(more)
edit retag flag offensive close merge delete

Comments

Have you tried the powershell provider instead? https://github.com/joshcooper/puppetlabs-powershell

nanliu gravatar imagenanliu ( 2014-03-26 01:30:59 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-07-21 21:49:02 -0600

dancewind gravatar image

Thanks for your suggestion. I tried to use the module, but failed with lots of issues. Finally, we rewrite the puppet script to cover all the powershell execution commands.

edit flag offensive delete link more

Comments

What specifically did you fail on with the powershell provider module? It now falls under the Puppet Supported Modules. :)

rob gravatar imagerob ( 2014-10-03 23:01:29 -0600 )edit

If this if what you believe to be the answer, I can mark it as the answer for you.

rob gravatar imagerob ( 2014-10-03 23:01:49 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-03-25 22:10:34 -0600

Seen: 225 times

Last updated: Mar 25 '14