I am trying to open a protected excel file and re-save it without the password. I created a PowerShell script and it works if I manually set the executionpolicy to remotesigned
or unrestricted
.
I would like to not enable scripts but just bypass it through SSIS. I have tried a bunch of things the following is what I tried, but it does not work.
EXECUTE PROCESS TASK
Executable: C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe
Arguement: -ExecutionPolicy ByPass -File "S:\PowerShell\UnlockExcel.ps1"
I have tried -Command instead of -File as well.
If I run the script after manually enabling scripts in PowerShell the script works so there is nothing wrong with the script, but if I put it back to restricted and try it with those arguments in SSIS it won't work.
Modify the executing line to include the following format.
-NoLogo -NoProfile -ExecutionPolicy Bypass -File
powershell.exe command line reference TechNet Link