Run batch file as administrator on Jenkins?
Our solution was to run the Jenkins' service as a separate local admin user. After installing Jenkins, Start => 'services' => Scroll to the Jenkins service => right click => properties => "log on" => "this account" => specify a local admin account.
Hopefully in newer Jenkins' builds it can work as the standard NETWORK SERVICE but for some reason it didn't with our box.
One of the solution:
- Create bat file in slave.
- Create shortcut of the file and right click the shortcut, properties -> Advanced -> check run asadministrator.
- Control Panel -> System and Security -> ActionCenter -> Change User Account Control Settings and set the level to"never notify".
- run the file on Jenkins
Somehow the file will be executed on slave server but it return failure on Jenkins.
This is My situation:
I need to use admin privileged console to run pywinauto script (written in python) to automate some app which requires admin privileged.
What I had tried:
- In my experience, install Windows Jenkins slave as a service creating more issue to take care with, so I don't go this route.
- To create a new process and it will open a new admin privileged shell and run command on it. But, in this way, Jenkins will not show its output, say in Blue Ocean.
What worked for me:
- Just manually open an admin privileged console to start the your_window_node.jnlp file and then this Jenkins slave will have admin privileged.