NoamSTMS
NoamSTMS

Reputation: 31

Jenkins PowerShell plugin unable to execute script - "ERROR: The target system must be running a 32 bit OS"

I'm trying to run a PowerShell script using the Jenkins PowerShell plugin and the script produces the following error:
"ERROR: The target system must be running a 32 bit OS"

The slave runs on a Windows 2008 R2 Server and the script runs well locally and remotely from my Windows 7/x64 desktop but it won't run through the plugin.
I also tried to run it using a Windows batch command plugin and that wouldn't work either - same error message.
I narrowed the issue and found the line that produces the error:

 $results = openfiles /query /fo csv | Select-String $versionPath

It looks like the OPENFILES command causes the problem and i think it is because Jenkins starts the x86 version of PowerShell but i'm not sure what needs to be done so it will run on the right CPU architecture.

Any help will be appreciated.

Upvotes: 1

Views: 1682

Answers (1)

NoamSTMS
NoamSTMS

Reputation: 31

Like i thought, Jenkins is running the jobs using the x86 versions of CMD and PowerShell. To get them running using their x64 versions i had to run the slave with the x64 version of Java.

The following solution came much later but that's the best way to go:

  1. Make sure you don't have any x86 versions of Java installed on your server. If you have 32bit Java versions installed, Jenkins slave will use these versions to run your jobs. x64 versions of Java can be downloaded here.
  2. Start the x64 version of Internet Explorer on your server and go to the 'Manage Nodes' page in Jenkins to install the slave on your server.
  3. Finally - install the slave as a Windows Service.

Upvotes: 2

Related Questions