Using Puppet and PowerShell: Long running scripts with good manifest logging

Welcome Forums General PowerShell Q&A Using Puppet and PowerShell: Long running scripts with good manifest logging

This topic contains 1 reply, has 2 voices, and was last updated by

 
Participant
1 year, 11 months ago.

  • Author
    Posts
  • #57842

    Participant
    Points: 0
    Rank: Member

    I have complex PowerShell scripts that I would like Puppet manifests to govern. I use a PowerShell plugin. I can have Puppet manifests transfer a PowerShell script and run it. The relevant messages of a Puppet Agent running and associated logs on the Puppet Agent server and Puppet master server can show a success well before the PowerShell script has finished. Is there a way or trick to getting a Puppet manifest to not show such quick "successes" and wait for the entire PowerShell script to actually finish? The solution may be more of a PowerShell fix than a Puppet fix.

  • #57862

    Participant
    Points: 0
    Rank: Member

    What is the behavior of launching an exe or Powershell in Puppet? Does it wait until Powershell.exe completes before continuing? It also matter what you doing in the Powershell code as well. Are you calling other EXE's or starting sub-processes in the Powershell code? My assumption is something is not set to wait until completion. Typically, Start-Process is used for EXE's because we can specify the -Wait parameter to have it not run any more code until the spawned process is complete. I also found this if it helps that Powershell is producing a non-terminating error that isn't being handled by Puppet:

    https://puppet.com/blog/tips-using-puppet-powershell-module

The topic ‘Using Puppet and PowerShell: Long running scripts with good manifest logging’ is closed to new replies.