I am trying to get a list of Vsphere templates and use them as parameters in Jenkins. I have tried using a function and running the PowerShell command.
def findtemplates() {
def $vmTemplate = "powershell -command 'Connect-VIServer -server server -User user -Password pass -Force; Get-Template | select name'"
return $vmTemplate
}
And in parameter section:
parameters {
choice(name: 'Template', choices: findtemplates(), description: 'test')
}
But does not work. Any help would be appreciated.