< Back

Get-JenkinsObject

Wed Jan 15, 2020 10:31 am

NAME Get-JenkinsObject



SYNOPSIS

Get a list of objects in a Jenkins master server.





SYNTAX

Get-JenkinsObject [-Uri] <String> [[-Credential] <PSCredential>] [[-Crumb] <String>] [-Type] <String> [-Attribute]

<String[]> [[-Folder] <String>] [[-IncludeClass] <String[]>] [[-ExcludeClass] <String[]>] [<CommonParameters>]





DESCRIPTION

Returns a list of objects within a specific level of the Jenkins tree.





PARAMETERS

-Uri <String>

Contains the Uri to the Jenkins Master server to execute the command 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



-Type <String>

The type of object to return. Defaults to jobs.



Required? true

Position? 5

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Attribute <String[]>

The list of attribute to return.



Required? true

Position? 6

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Folder <String>

The optional job folder to retrieve the jobs from. This requires the Jobs Plugin to be installed on Jenkins.



Required? false

Position? 7

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-IncludeClass <String[]>

This allows the class of objects that are returned to be limited to only these types.



Required? false

Position? 8

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ExcludeClass <String[]>

This allows the class of objects that are returned to exclude these types.



Required? false

Position? 9

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

An array of Jenkins objects.







NOTES









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



PS C:\\>$Jobs = Get-JenkinsObject `

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

-Credential (Get-Credential) \\`

-Type 'jobs' \\`

-Attribute 'name','buildable','url','color' \\`

-Verbose



Returns the list of jobs on https://jenkins.contoso.com using the credentials provided by the user.

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



$Jobs = Get-JenkinsObject `

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

-Credential (Get-Credential) \\`

-Folder 'Misc' \\`

-Type 'jobs' \\`

-Attribute 'name','buildable','url','color' \\`

-Verbose



Returns the list of jobs in the 'Misc' folder on https://jenkins.contoso.com using the credentials provided by the

user.



RELATED LINKS