< Back

Invoke-JenkinsJob

Wed Jan 15, 2020 10:36 am

NAME Invoke-JenkinsJob



SYNOPSIS

Invoke an existing Jenkins Job.





SYNTAX

Invoke-JenkinsJob [-Uri] <String> [[-Credential] <PSCredential>] [[-Crumb] <String>] [[-Folder] <String>] [-Name]

<String> [[-Parameters] <Hashtable>] [<CommonParameters>]





DESCRIPTION

Runs an existing Jenkins Job. If a folder is specified it will run the job in the specified folder. If the job

does not exist an error will occur.





PARAMETERS

-Uri <String>

Contains the Uri to the Jenkins Master server to set the Job definition on.



Required? true

Position? 2

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Credential <PSCredential>

Contains the credentials to use to authenticate with the Jenkins Master server.



Required? false

Position? 3

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Crumb <String>

Contains a Crumb to pass to the Jenkins Master Server if CSRF is enabled.



Required? false

Position? 4

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Folder <String>

The optional job folder the job is in. This requires the Jobs Plugin to be installed on Jenkins. If the folder

does not exist then an error will occur.



Required? false

Position? 5

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Name <String>

The name of the job to set the definition on.



Required? true

Position? 6

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Parameters <Hashtable>

This is a hash table containg the job parameters for a parameterized job. The parameter names are case

sensitive. If the job is a parameterized then this parameter must be passed even if it is empty.



Required? false

Position? 7

Default value None

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

None.







NOTES









-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Invoke-JenkinsJob `

-Uri 'https://jenkins.contoso.com' \\`

-Credential (Get-Credential) \\`

-Name 'My App Build' \\`

-Verbose



Invoke the 'My App Build' job on https://jenkins.contoso.com using the credentials provided by the user.

-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Invoke-JenkinsJob `

-Uri 'https://jenkins.contoso.com' \\`

-Credential (Get-Credential) \\`

-Folder 'Misc' \\`

-Name 'My App Build' \\`

-Verbose



Invoke the 'My App Build' job from the 'Misc' folder on https://jenkins.contoso.com using the credentials provided

by the user.

-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Invoke-JenkinsJob `

-Uri 'https://jenkins.contoso.com' \\`

-Credential (Get-Credential) \\`

-Name 'My App Build' \\`

-Parameters @{ verbosity = 'full'; buildtitle = 'test build' } \\`

-Verbose



Invoke the 'My App Build' job on https://jenkins.contoso.com using the credentials provided by the user and

passing the build parameters verbosity and buildtitle.



RELATED LINKS