0

I want to create a COM object, internet explorer application. The following code works fine in PowerShell ISE (32 bit):

$ie = New-Object -com InternetExplorer.Application

But, when I try running it on Jenkins Windows server (using either the powershell plugin or calling the PS1 with a batch file), I get the following error.

Building on master in workspace C:\Program Files\Jenkins\workspace\Jenkins Test
[Jenkins Test] $ powershell.exe -NonInteractive -ExecutionPolicy ByPass "& 'C:\WINDOWS\TEMP\hudson3148932824880446098.ps1'"
New-Object : Creating an instance of the COM component with CLSID
{0002DF01-0000-0000-C000-000000000046} from the IClassFactory failed due to the
following error: 80004005.
At C:\WINDOWS\TEMP\hudson3148932824880446098.ps1:1 char:17
+ $ie = New-Object <<<<  -com InternetExplorer.Application
    + CategoryInfo          : ResourceUnavailable: (:) [New-Object], COMException
    + FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Commands.NewObjectCommand

I'm using a VM at work (Server 2003). I'm not sure if this is an issue with my server permissions or if these are interactive commands being used with a non-interactive device. Can anyone help?

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
LeChuck
  • 71
  • 9
  • The "working code" and error do not match? Are you trying to draw a comparison based on COM objects? – Matt Sep 14 '16 at 11:45
  • How is this different from [the question you posted yesterday](http://stackoverflow.com/questions/39472969/why-cant-this-powershell-command-be-executed-within-jenkins)? – Mathias R. Jessen Sep 14 '16 at 11:48
  • Sorry, pasted in the wrong error code. Fixed it now. I just want to focus on COM object error. – LeChuck Sep 14 '16 at 11:58
  • 80004005 is a rather generic error. Do you see anything related in the Jenkins or Windows logs? – Ansgar Wiechers Sep 14 '16 at 12:25
  • There is nothing about it in the logs. They just report the code was executed successfully, despite the errors. – LeChuck Sep 14 '16 at 14:12
  • Please run this command on the failing machine and post the output: `get-childitem -recurse "REGISTRY::HKEY_CLASSES_ROOT\CLSID\{0002DF01-0000-0000-C000-000000000046}"`. Also check if the file `C:\Program Files\Internet Explorer\IEXPLORE.EXE` exists. – Burt_Harris Sep 15 '16 at 22:37
  • Hi. This code just returns an error saying it cannot find the path because it doesn't exist. The file is located in that folder. – LeChuck Sep 16 '16 at 09:11

0 Answers0