private/steps/Update-ConfluenceGroupsUsers.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
function Update-ConfluenceGroupsUsers { [CmdletBinding()] param ( # The names of the groups to retrieve users for [Parameter(Mandatory,Position=0)] [string[]] $Groups, # The ID value of the refresh underway [Parameter(Mandatory,Position=1)] [int] $RefreshId, # The sql instance to update data in [Parameter(Mandatory,Position=2)] [string] $SqlInstance, # The sql database to update data in [Parameter(Mandatory,Position=3)] [string] $SqlDatabase, # The schema to use when updating data [Parameter(Position=4)] [string] $SchemaName="dbo" ) begin { Write-Verbose "Updating Group Users" $tableName = "tbl_stg_Confluence_User_Group" $userGroups = @() $sqlConnSplat = @{ DatabaseServer = $SqlInstance DatabaseName = $SqlDatabase SchemaName = $SchemaName } } process { Write-Verbose "Getting Groups' Users" foreach ($g in $Groups) { $userGroups += Get-ConfluenceGroupsUsers $g | Read-ConfluenceGroupUser -Group $g -RefreshId $RefreshId } } end { Write-AtlassianData @sqlConnSplat -Data $userGroups -TableName $tableName } } |