Workaround for Permission denied when using Jenkins to run commands
Sometime when Jenkins is installed with different user and when we try to execute something on the slave machine which requires elevated access the Jenkins jobs throws error :-
ACCESS DENIED
0 FILE COPIED
ISSUE Link for more detail :-
https://issues.jenkins-ci.org/browse/JENKINS-36756
Steps to resolve this issue
- First we require to disable UAC
type “uac” into the search box, and then click the “Change User Account Control settings” result. On Windows 8, we’ll use the Start screen (instead of the Start menu), and we’ll have to change our search to “settings” but it still works basically the same.
In the “User Account Control Settings” window, drag the slider all the way down to the “Never Notify” setting. Click “OK” when we’re done.
- So following above these simple steps will disable UAC
- Next we need to configure we require to configure elevate – Command-Line UAC Elevation Utility we can download the zip file provided elevate-1.3.0-redist.7z and unzip it at required location and further we have to use elevateUtility\bin.x86-32\elevate.exe .
- Under the Jenkins batch job command just add elevate.exe –k filename.bat below is an example
echo “Begin elevate Test”
cd C:\Users\Documents
C:\Users\Downloads\elevateUtility\bin.x86-32\elevate.exe -k filename.bat
5. So above command should able to execute the filename.bat file without giving access denied issue