0

I'm struggling with very similar issue to the one described in this topic: . I use PowerShell Remote session to start Internet Explorer application on Remote Computer (I use 'new-object -com InternetExplorer.Application' command.

Everything works great (the session, object creation...) until I call 'ExecWB(6,2)' method. I want to use this method to automatically print page from IE.

After calling that method nothing happens and, what is more, the com object loses information about itself. I cannot use any of its other methods anymore (which worked correctly earlier). The 'gm' command shows only basic COM object methods.

I have spend a lot of time searching for solution - checking if WMI, RPC services work, checking firewall rules, Internet Explorer security zones settings, printer sharing settings...). But I cannot find solution.

What is more, when I do the same from PowerShell window on target computer - everything works correctly. Problem occurs only when I am using Powershell remote sessions.

Does ExecWB method needs some special settings to use it? I'm trying to print a htm file located on the disk of the target computer (which I am connecting to using Powershell remote session). The file opens without problems but I cannot use ExecWB method.

Every helpful screens are already under the provided link. Thank you in advance for help.

Wiktor
  • 1
  • have a look at the script in the comments over there https://richardspowershellblog.wordpress.com/2007/07/11/printing-from-internet-explorer/ where it prints out any errors. – Guenther Schmitz Sep 04 '21 at 09:21
  • Have you enable the option `Allow scriptlets` in IE Tools => `Internet Options` => `Security` => `Security Settings`? – Xudong Peng Sep 07 '21 at 08:35
  • @XudongPeng , yes i tried that. I enabled that option for all security zones and also tried to turn off the protected modes in that zones - nothing helps. I have read that the changing security zones are the most common cause for loosing information of the com object during method calling but I really do not know what settings I can try yet. – Wiktor Sep 07 '21 at 09:11
  • What is more, the Powershell Commands cannot be executed also with the use of e.g. Task Scheduler. When I put the powershell commands into '.ps1' file and make bat file to run this - nothing happen. The task in TaskScheduler ends successfull but nothing is printed. On the other hand, if I double-click the bat file - everything works correctly. – Wiktor Sep 07 '21 at 09:34
  • According to your description, I think this may be related to permissions. Have you tried to execute these scripts with administrator permissions? – Xudong Peng Sep 09 '21 at 10:01

0 Answers0