JiraPS
JiraPS copied to clipboard
Bulk get Jira Users
Not sure if you would want a new function or just add a bulk switch for the existing Get-JiraGroups function.
I needed this in a hurry so I just knocked something up that will work for now. If someone wants to reformat and add, feel free, or just close this issue.
I used api v2 as that seems to be what the rest of the module uses. Sorry its a little hacky I just don't have time today.
`function Get-JiraGroupBulk { [CmdletBinding()] param( [Parameter()] [System.Management.Automation.PSCredential] [System.Management.Automation.Credential()] $Credential = [System.Management.Automation.PSCredential]::Empty )
begin {
$server = Get-JiraConfigServer -ErrorAction Stop
}
process {
$values = @()
$i = 0
do {
$parameter = @{
URI = "$server/rest/api/2/group/bulk?maxResults=100&startAt=$i"
Method = "GET"
Credential = $Credential
}
$result = Invoke-JiraMethod @parameter
$values += $result.values
$i += 100
} until ($result.isLast -eq $true)
}
end {
$values
}
}`