Hi, I have a powershell script which I'm trying to implement within an exec/onlyif condition. The script I'm working with is quite complex so I don't really want to put all of the logic inline and would prefer it stayed contained within the .ps1. I'm running into issues calling powershell and returning an exit code. For example my .ps1 file has a statement like this: If (condition) { # run exec command => exit 1 } else { # don't run exec command => exit 0 } In my exec I have a command structured like so: exec { "run-script": path => 'C:\Windows\sysnative\WindowsPowershell\v1.0', command => "powershell.exe -File C:/myscript.ps1 arg1 arg2", onlyif => "powershell.exe -File C:/myscript.ps1 -runcheck", } Regardless of the condition / exit code within the script the command portion always runs always runs. I've tried to switch out -File for -Command without success. Can anyone point out a way around this? Regards, Leon -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAPnT6nN51aUYOSBTYzD6M-X9768pG2WwE6vXzQnJGNNATR7cgw%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.