[JENKINS-17318]

This should address https://issues.jenkins-ci.org/browse/JENKINS-17318

I have tested the changes on a Jenkins build server on Windows Server 2012 and another on CentOS 6.3.