Run batch file as administrator on Jenkins?

后端 未结 4 1538
执笔经年
执笔经年 2021-02-07 09:57

We\'re using Jenkins on Win8 x64 to build (msbuild), package (cspack), run (csrun) and test (nunit) an azure cloud services project. The Azure cloud service emulators need to ru

相关标签:
4条回答
  • 2021-02-07 10:28

    If you'll log to the widows machine as an administrator and run the slave agent from this user, everything will be running under the administrator user

    0 讨论(0)
  • 2021-02-07 10:38

    One of the solution:

    1. Create bat file in slave.
    2. Create shortcut of the file and right click the shortcut, properties -> Advanced -> check run as administrator.
    3. Control Panel -> System and Security -> Action Center -> Change User Account Control Settings and set the level to "never notify".
    4. run the file on Jenkins

    Somehow the file will be executed on slave server but it return failure on Jenkins.

    0 讨论(0)
  • 2021-02-07 10:40

    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:

    1. In my experience, install Windows Jenkins slave as a service creating more issue to take care with, so I don't go this route.
    2. 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:

    1. Just manually open an admin privileged console to start the your_window_node.jnlp file and then this Jenkins slave will have admin privileged.
    0 讨论(0)
  • 2021-02-07 10:47

    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.

    0 讨论(0)
提交回复
热议问题