Reputation: 97
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.
Upvotes: 0
Views: 1952
Reputation: 78
This worked for me on Windows 2007 machine.I will update my answer when I deploy this on Server 2012 - I am hoping I don't have to reinvent the wheel again. MOre to come...
Executable: %windir%\system32\WindowsPowerShell\v1.0\PowerShell.exe
Arguments: -NoProfile "C:\temp\scripts\vpn.ps1"
Upvotes: 0
Reputation: 825
Modify the executing line to include the following format.
-NoLogo -NoProfile -ExecutionPolicy Bypass -File
powershell.exe command line reference TechNet Link
Upvotes: 1