-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
detect when running scripts is disabled on Windows #2
Comments
Hello Thanks and happy new year :) Sorry, I only have one clue for now: I remember a colleague had to switch on a permission to execute PowerShell. On Windows, a PowerShell script is launched and it uses Component Object Model from Microsoft. Could you check your permissions if any relative to that? |
when you "thumb up", does that mean this was the problem and it worked or do that mean "I'll check"? :) |
Means I'll check! Do you have some a sample PowerShell script I could test? |
here is a sample https://powershellbyexample.dev/post/hello-world/ |
Oh yes, sorry wasn't clear. I can use PowerShell and the examples you linked work (I tested a few different commands). I meant, do you have a PowerShell script using the Component Object Model I could test. |
(Not tested as I don't have Windows for now), change
|
Yes this works. |
ok, sorry, I have no more clue for now |
I will try to look at the code later this week and see if I figure out where the problem is. |
It was a problem with permissions. Running this adapted from docx2pdf_win(): |
Haaaa! perfect, thanks for the feedback I'll try to add a function to test this case |
I had the same problem. My execution policy was set to "RemoteSigned". To try it out, I set it to "Unrestricted" and it worked. I'm not well versed in PowerShell or IT security, so I'd like to ask if what I did is too risky and if there's a better way to enable the scripts used by doconv while keeping "RemoteSigned" policy. |
Thanks for your comment I would say, if you use the CRAN version, the risk of getting a hacked version is low, specially if you are in a managed and administrated environment. But if you switch that thing off, then you're exposed to other vulnerabilities. Your IT may recommend you not to do so if you ask them. I don't think my script is dangerous but some others may be. I use the product to help me with doc and visual testing. I am not really able to advise on this subject. |
Thank you very much for your quick reply. I'll ask IT then. I guess I could keep that policy as it was and switch it only when I need to run doconv. Anyways, thank you for this and your other packages. They are really helpful! |
Stop if PowerShell (PS) execution strategy does not allow running scripts and advise user. PS scripts are required for certain actions on Windows (ardata-fr#2).
After going slightly mad about the functions not executing on Windows 😭 , I finally stumbled across this issue. I prepared this PR #9 |
Internals: Fail with clear error message if scripts not allowed by PS execuction policy (#2)
I am trying to used the to_pdf() function to convert a word document to pdf. I kept getting an error with my docx file so tested with the examples from the documentation:
docx_file <- system.file(package = "doconv", "doc-examples/example.docx")
to_pdf(docx_file, output = "docx_example.pdf")
Error: could not convert C:/Users/gspiteri/AppData/Local/R/win-library/4.2/doconv/doc-examples/example.docx
doconv::msoffice_available() returns TRUE
I am using this version of Word: Microsoft® Word for Microsoft 365 MSO (Version 2210 Build 16.0.15726.20188) 64-bit
Appreciate any help. Thanks and Merry Christmas!
The text was updated successfully, but these errors were encountered: