Advertisement
omareg94

Result of example trying to get id of all windows

May 9th, 2020
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. PS C:\Users\MYUSERNAME> $OneNote = New-Object -ComObject OneNote.Application
  2. PS C:\Users\MYUSERNAME> $binding = "System.Reflection.BindingFlags" -as [type]
  3. PS C:\Users\MYUSERNAME> foreach ($window in $OneNote.Windows) {
  4. >>   $page_id = [System.__ComObject].InvokeMember("CurrentPageId", $binding::GetProperty, $null, $window, $null)
  5. >>   Write-Output $page_id
  6. >> }
  7. Exception calling "InvokeMember" with "5" argument(s): "Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))"
  8. At line:2 char:3
  9. +   $page_id = [System.__ComObject].InvokeMember("CurrentPageId", $bind ...
  10. +   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  11.     + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
  12.     + FullyQualifiedErrorId : COMException
  13.  
  14. Exception calling "InvokeMember" with "5" argument(s): "Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))"
  15. At line:2 char:3
  16. +   $page_id = [System.__ComObject].InvokeMember("CurrentPageId", $bind ...
  17. +   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  18.     + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
  19.     + FullyQualifiedErrorId : COMException
  20.  
  21. Exception calling "InvokeMember" with "5" argument(s): "Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))"
  22. At line:2 char:3
  23. +   $page_id = [System.__ComObject].InvokeMember("CurrentPageId", $bind ...
  24. +   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  25.     + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
  26.     + FullyQualifiedErrorId : COMException
  27.  
  28. Exception calling "InvokeMember" with "5" argument(s): "Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))"
  29. At line:2 char:3
  30. +   $page_id = [System.__ComObject].InvokeMember("CurrentPageId", $bind ...
  31. +   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  32.     + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
  33.     + FullyQualifiedErrorId : COMException
  34.  
  35. Exception calling "InvokeMember" with "5" argument(s): "Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))"
  36. At line:2 char:3
  37. +   $page_id = [System.__ComObject].InvokeMember("CurrentPageId", $bind ...
  38. +   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  39.     + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
  40.     + FullyQualifiedErrorId : COMException
  41.  
  42. Exception calling "InvokeMember" with "5" argument(s): "Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))"
  43. At line:2 char:3
  44. +   $page_id = [System.__ComObject].InvokeMember("CurrentPageId", $bind ...
  45. +   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  46.     + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
  47.     + FullyQualifiedErrorId : COMException
  48.  
  49. Exception calling "InvokeMember" with "5" argument(s): "Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))"
  50. At line:2 char:3
  51. +   $page_id = [System.__ComObject].InvokeMember("CurrentPageId", $bind ...
  52. +   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  53.     + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
  54.     + FullyQualifiedErrorId : COMException
  55.  
  56. PS C:\Users\MYUSERNAME>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement