Public/Get-bConnectStaticGroup.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 54 55 56 57 58 59 |
Function Get-bConnectStaticGroup() { <# .Synopsis Get specified Static Group. .Parameter StaticGroup Name (wildcards supported) or GUID of the Static Group. .Parameter OrgUnit Valid GUID of a OrgUnit with Static Groups .Outputs Array of StaticGroup (see bConnect documentation for more details) #> Param( [string]$StaticGroup, [string]$OrgUnit ) $_connectVersion = Get-bConnectVersion If($_connectVersion -ge "1.0") { If(![string]::IsNullOrEmpty($StaticGroup)) { If(Test-Guid $StaticGroup) { $_body = @{ Id = $StaticGroup } return Invoke-bConnectGet -Controller "StaticGroups" -Data $_body -Version $_connectVersion } else { # fetching static groups with name is not supported; therefore we need a workaround for getting the specified static group... $_bmsVersion = Get-bConnectInfo If($_bmsVersion.bMSVersion -imatch "16.*") { # Search available since bMS 2016R1 $_groups = Search-bConnectStaticGroup -Term $StaticGroup $_ret_groups = @() Foreach($_grp in $_groups) { $_ret_groups += Get-bConnectStaticGroup -StaticGroup $_grp.Id } return $_ret_groups } return $false } } elseif (![string]::IsNullOrEmpty($OrgUnit)) { If(Test-Guid $OrgUnit) { $_body = @{ OrgUnit = $OrgUnit } return Invoke-bConnectGet -Controller "StaticGroups" -Data $_body -Version $_connectVersion } else { return $false } } else { return Invoke-bConnectGet -Controller "StaticGroups" -Version $_connectVersion } } else { return $false } } |