run powershell code from stored proc to zip files

  • is there a way to run command below in tsql, runs from powershell fine (xpcmdshell is on)

    exec xp_cmdshell 'powershell ""compress-archive -Path c:\media\dm1210.csv -DestinationPath c:\media\dmtim.zip""'

  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • Probably the easiest way to do it would be to have a SQL Agent job with your PowerShell code in it (a SQL Agent step can be PowerShell) and then use msdb.dbo.sp_start_job in your stored procedure to run that.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply