exec and PowerShell command

asked 2018-11-14 12:29:15 -0600

Dan1 gravatar image

updated 2018-11-14 12:30:02 -0600

Hi, I'm trying to run this code:

      exec {
          "run_backup_${db}" :
            command     => "invoke-sqlcmd -Username ${sql_user} -Password ${sql_pass} -ErrorAction Stop -serverinstance ${db_host} -database master -Query ${query} -QueryTimeout 0 -OutputSqlErrors 1",
            timeout     => 600,
            logoutput   => true,
            creates     => "${db_back_path1}\\${db}.bak",
            provider    => powershell;    
        }

When I checked the log, I noticed that I get this message: returned 1 instead of one of [0] (this isn't informative message...)

if I run this command from PowerShell (not with puppet) I get this message: "invoke-sqlcmd : BACKUP DATABASE permission denied in database x" This is the message that I want to get from puppet...

Does someone know how can I display the original message (the same message that I get in PowerShell prompt)?

Thanks a lot!

edit retag flag offensive close merge delete