Answer by borispinsky ·
You have a few options:
1. The easy way is to use xp_cmdshell inside your procedure (be aware of a security risk )
2.Create SQL server job with Powershell step and run the job fro your procedure
3.Build a SSIS package with Process Task run the package from your procedure
Answer by swiden ·
Thanks for your contribution!
In a SQL agent job, T-SQL step that processes a stored procedure. From that SP do I execute a Powershell script as:
set @CmdPowershell ='Powershell -file '+char(34)+'\\SRVqwert\SWIDEN\PS_script.ps1'+char(34)
EXEC @rc =MASTER..xp_cmdshell @CmdPowershell
if @rc != 0
I have issues with error "must be digitally sign". I don´t know how to go further.
xp_cmdshell is used just to reach Powershell. Any way to avoid xp_cmdshell? How much security risk is xp_cmdshell?, impossible question but..