0

I'm using onenote as a documentation tool for some trivial tests and I sometimes use scripts. I was using aside multiple scripts for automating stuff.

I would like to include these scripts in Microsoft OneNote (it is possible to include file in Onenote pages). Then the objective is to execute the script from there.

It is not working; after double-clicking, a powershell window appear and disappear instantly.

Any ideas?

Edit The error message was caught in a screenshot:

enter image description here

11
  • Does PowerShell: Press any key to continue give you any inspiration? Commented Jan 19, 2020 at 16:45
  • @AndrewMorton: I think you're assuming that the O.P. is asking how to make the script pause. Might not be the case. Commented Jan 19, 2020 at 16:51
  • Might be that the PS window appears and disappears instantly because whatever your script is executing very fast. The PS window persists for only as long as it takes the script to execute. What does your script do? Is it doing it? If not, you may want to temporarily add a pause as suggested by Andrew just to see if your script is throwing an error (exceptions are displayed in red in the PS window). If it is, debug the script using the ISE, then try again in OneNote. Commented Jan 19, 2020 at 16:54
  • Hi, welcome to stackoverflow. See How to ask if you want to raise your chances to get an answer. We'd expect to see code of what you tried and what is going wrong (error message, weird behaviors, etc) in order to assist you. To give you a general answer, yes it is possible. You'd need some Powershell in the first place to query OneNote API, retrieve the script and execute it. Look into one note API doc to get started.: learn.microsoft.com/en-us/graph/integrate-with-onenote, Commented Jan 19, 2020 at 19:36
  • Once you have obtained your script from the API, you can do something like Chocolatey Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) except you'd replae the DownloadString bit for a variable or expression containing the result of your OneNote api call. Commented Jan 19, 2020 at 19:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.