Attended one of those sessions where the key selling point was “how to get things done”. In other words, get your sh*t together and get organized with zero emails in you inbox. It is a whole philosophy, google it :-)
Well one of the suggestions was to use the “send to onenote” program that is installed with OneNote. Of course that is way to may clicks for me and my mouse and I started to look into a quicker way of doing it in powershell, what else?
Turns out there are very few posts on the subject, sending things from powershell to OneNote. Found a couple of references using c# and that is almost powershell so of I went and created this function Out-Note.
(Out-Note)
The function takes two parameters. Note = The text you want to send to OneNote and an optional parameter Section that defaults to “General”.
UPDATE - 23 March 2015
Received a tweet from Jan Egil Ring (Powershell MVP - @JanEgilRing). He was having issues with the function. It would only create a new page in OneNote if OneNote was NOT running. We tried a couple of things, however the error remained (New-Object : Retrieving the COM class factory for component with CLSID {DC67E480-C3CB-49F8-8232-60B0C2056C8E} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT:0x80080005 (CO_E_SERVER_EXEC_FAILURE))). Checking the eventlog we found this message:
The server {DC67E480-C3CB-49F8-8232-60B0C2056C8E} did not register with DCOM within the required timeout.
Well that did not help resolve the issue, however Jan Egil then tried to run the function from an powershell session that was not elevated as an administrator and that worked. So the error above is due to missing cached credentials for your local administrator. To fix it, start OneNote as an administrator (right click the icon and choose "Run as Administrator") and sign in to OneDrive from OneNote.
I have also renamed the function from Send-Note to Out-Note as is a more powershell friendly name (thank you Jan Egil, I stole the name from you :-))
Cheers
Tore
Well one of the suggestions was to use the “send to onenote” program that is installed with OneNote. Of course that is way to may clicks for me and my mouse and I started to look into a quicker way of doing it in powershell, what else?
Turns out there are very few posts on the subject, sending things from powershell to OneNote. Found a couple of references using c# and that is almost powershell so of I went and created this function Out-Note.
(Out-Note)
The function takes two parameters. Note = The text you want to send to OneNote and an optional parameter Section that defaults to “General”.
UPDATE - 23 March 2015
Received a tweet from Jan Egil Ring (Powershell MVP - @JanEgilRing). He was having issues with the function. It would only create a new page in OneNote if OneNote was NOT running. We tried a couple of things, however the error remained (New-Object : Retrieving the COM class factory for component with CLSID {DC67E480-C3CB-49F8-8232-60B0C2056C8E} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT:0x80080005 (CO_E_SERVER_EXEC_FAILURE))). Checking the eventlog we found this message:
The server {DC67E480-C3CB-49F8-8232-60B0C2056C8E} did not register with DCOM within the required timeout.
Well that did not help resolve the issue, however Jan Egil then tried to run the function from an powershell session that was not elevated as an administrator and that worked. So the error above is due to missing cached credentials for your local administrator. To fix it, start OneNote as an administrator (right click the icon and choose "Run as Administrator") and sign in to OneDrive from OneNote.
I have also renamed the function from Send-Note to Out-Note as is a more powershell friendly name (thank you Jan Egil, I stole the name from you :-))
Cheers
Tore
Comments
Post a Comment