task install_vesper_dependencies_on_load_vms {
description "Executes Vepper's setup.exe to install C++ redistributable on loadVMs."
doLast {
exec {
workingDir 'cpt-op-01-load1/C$/vesper_cpt'
standardOutput = new ByteArrayOutputStream()
logger.info "Installing dependencies on $loadVM1..."
commandLine 'cmd', '/c', "vepper-$vepperVersion-setup.exe", '/S', 'runas', '5'
ext.output = {standardOutput.toString() }
}
}
It gives me error that Exec does not support UNC paths. If this is the case could any one please redirect me how can I run commands on remote machine using Gradle.
If it’s Windows then use can use groowin. It does not have a specific Gradle plugin, but if you put it on the buildscript classpath, you can create a custom task to run it.
I have checked groowin and it seems really cool. I have tried adding the following block into my build script. Though it is able to download dependencies from Maven but giving me the following error:
unable to resolve class com.aestasit.winrm.DefaultWinRM
import static com.aestasit.winrm.DefaultWinRM.*
and not import static com.aestasit.winrm.DefaultWinRM.*
I will request them to update README according to the new import. Now, I am going to try groowin to see if it works for me. I will keep you posted. Thanks
@Schalk_Cronje Schalk_Cronje, I have tried integrating groowin into my buildscript. It works and tried to connect to port 5985 by default. But on this port the machine is not listening.Then, I overrided port to 4445 on which the machine is listening. Now, it establishes the connection that I can see. But my build get stuck after connecting and does not execute any command. I have attached a picture showing my code snippet and my build status. Could you please suggest something?
I will do that too. Alot of my work would be dependent on whether I would be able to leverage Groowin or not. Otherwise, i will have to fall back to powershell files and that would be not a very clean solution. Will keep you posted. Thanks
Also, there is a Packer project to create VM box against which we tested WinRM implementation in Groowin: https://github.com/aestasit/groowin-test-box. You can find some Windows configuration details in there.
Can you also run your gradle build with -D option and share the output?
Executed build file but it is throwing exception. Though, this time it is not stuck like the last time but it is failing. I am getting the following error:
I got the ball rolling somehow.
The authentication error is due to the winrm service has “Kerberose” and “Negotiate” in auth section.
Auth
Basic = true
Kerberos = true
Negotiate = true [Source=“GPO”]
Certificate = false
CredSSP = false
CbtHardeningLevel = Relaxed
By default, it selects the Kerberos mode. So when disabling the Kerberose, it was still producing auth error(401).
NEGOTIATE authentication error: No valid credentials provided (Mechanism level
No valid credentials provided (Mechanism level: Failed to find any Kerberos tg
)
NEGOTIATE authentication error: No valid credentials provided (Mechanism level
No valid credentials provided (Mechanism level: Failed to find any Kerberos tg
)
Then if the Kerberose is set to false, it tries Negotiate mode. When i disabled both (by setting them as false), I was able to execute the commands by exec. But disabling Kerberose has its own disadvantages.
My concern iis, the documentation is not briefly provided for this. We don;t know what additional parameters are supported in remoteManagement.