Functions/Copy-IAGroup.ps1
Function Copy-IAGroup{ Param( [String]$NewName, [Parameter(Mandatory = $true, ParameterSetName = 'NotInteractive')] $IAGroup, [Parameter(Mandatory = $true, ParameterSetName = 'NotInteractive')] $IAView, [Switch]$PassThru, [Switch]$IncludeAll, [Parameter(Mandatory = $true, ParameterSetName = 'Interactive')] [Switch]$Interactive ) if($Interactive){ $IAGroup = Get-IAGroup -All | Out-GridView -PassThru $IAView = Get-IAView -All | Out-GridView -PassThru } $IAGroupObject = $IAGroup | Select-Object -Property Title, Description, ColumnIndex, WidthInPercentage, TenantId $IAGroupObject | Add-Member -MemberType NoteProperty -Name 'ViewId' -Value $IAView.Id if($NewName){ $IAGroupObject.Title = $NewName } $newIAGroup = New-IAGroup -IAGroup $IAGroupObject -Passthru if($IncludeAll){ $IAGroup = Get-IAGroup -Id $IAGroup.Id -Expand foreach($item in $IAGroup.Widgets){ $IAWidget = Get-IAWidget -Id $item.Id -Expand -IncludeConfiguration $IAWidget.GroupId = $newIAGroup.Id $IAWidget = Copy-IAWidget -IAWidget $IAWidget } } if($PassThru){ return $IADataDefinitionObject } } |