linking groups implemented

This commit is contained in:
Karl-Wilfried Zimmer 2024-07-14 16:27:01 +02:00
parent 52afe64a1b
commit a8f94c7d78
3 changed files with 16 additions and 14 deletions

View File

@ -15,11 +15,11 @@ $ret=@()
if($PSBoundParameters.ContainsKey("ProjectName")){ if($PSBoundParameters.ContainsKey("ProjectName")){
if($PSBoundParameters.ContainsKey("Server")){ if($PSBoundParameters.ContainsKey("Server")){
$ret += New-ADGroup -Path $ACL -Server $Server -Name $Read -GroupCategory Security -GroupScope Global $ret += New-ADGroup -Path $ACL -Server $Server -Name $Read -GroupCategory Security -GroupScope Global -PassThru
$ret += New-ADGroup -Path $ACL -Server $Server -Name $Write -GroupCategory Security -GroupScope Global $ret += New-ADGroup -Path $ACL -Server $Server -Name $Write -GroupCategory Security -GroupScope Global -PassThru
} else { } else {
$ret += New-ADGroup -Path $ACL -Name $Read -GroupCategory Security -GroupScope Global $ret += New-ADGroup -Path $ACL -Name $Read -GroupCategory Security -GroupScope Global -PassThru
$ret += New-ADGroup -Path $ACL -Name $Write -GroupCategory Security -GroupScope Global $ret += New-ADGroup -Path $ACL -Name $Write -GroupCategory Security -GroupScope Global -PassThru
} }
return $ret return $ret
} }

View File

@ -15,11 +15,11 @@ $ret=@()
if($PSBoundParameters.ContainsKey("ProjectName")){ if($PSBoundParameters.ContainsKey("ProjectName")){
if($PSBoundParameters.ContainsKey("Server")){ if($PSBoundParameters.ContainsKey("Server")){
$ret += New-ADGroup -Path $Roles -Server $Server -Name $Read -GroupCategory Security -GroupScope Global $ret += New-ADGroup -Path $Roles -Server $Server -Name $Read -GroupCategory Security -GroupScope Global -PassThru
$ret += New-ADGroup -Path $Roles -Server $Server -Name $Write -GroupCategory Security -GroupScope Global $ret += New-ADGroup -Path $Roles -Server $Server -Name $Write -GroupCategory Security -GroupScope Global -PassThru
} else { } else {
$ret += New-ADGroup -Path $Roles -Name $Read -GroupCategory Security -GroupScope Global $ret += New-ADGroup -Path $Roles -Name $Read -GroupCategory Security -GroupScope Global -PassThru
$ret += New-ADGroup -Path $Roles -Name $Write -GroupCategory Security -GroupScope Global $ret += New-ADGroup -Path $Roles -Name $Write -GroupCategory Security -GroupScope Global -PassThru
} }
return $ret return $ret

View File

@ -14,19 +14,21 @@ $r
if($PSBoundParameters.ContainsKey("ProjectName")){ if($PSBoundParameters.ContainsKey("ProjectName")){
if($PSBoundParameters.ContainsKey("Server")){ if($PSBoundParameters.ContainsKey("Server")){
$ret = New-ADGroup -Path $Projects -Server $Server -Name $ProjectName -GroupCategory Security -GroupScope Global $ret = New-ADGroup -Path $Projects -Server $Server -Name $ProjectName -GroupCategory Security -GroupScope Global -PassThru
$ret = Get-ADGroup $ProjectName -SearchBase $Projects -Server $Server
$acl = . .\AddProjectACL.ps1 -ProjectName $ProjectName -Server $Server $acl = . .\AddProjectACL.ps1 -ProjectName $ProjectName -Server $Server
$r = . .\AddProjectRoles.ps1 -ProjectName $ProjectName -Server $Server $r = . .\AddProjectRoles.ps1 -ProjectName $ProjectName -Server $Server
#$ret | Add-ADGroupMember -Members $acl,$r #$ret | Add-ADGroupMember -Members $acl,$r
$acl | ForEach-Object {New-ADGroupMember -Identity $ret -Member $_ -Server $Server} $acl | ForEach-Object {add-ADGroupMember -Identity "$ret.DistinguishedName" -Members $_ -Server $Server}
$r | ForEach-Object {New-ADGroupMember -Identity $ret -Member $_ -Server $Server} $r | ForEach-Object {Add-ADGroupMember -Identity "$ret.DistinguishedName" -Members $_ -Server $Server}
} else { } else {
$ret = New-ADGroup -Path $Projects -Name $ProjectName -GroupCategory Security -GroupScope Global $ret = New-ADGroup -Path $Projects -Name $ProjectName -GroupCategory Security -GroupScope Global -PassThru
$ret = Get-ADGroup $ProjectName -SearchBase $Projects
$acl = . .\AddProjectACL.ps1 -ProjectName $ProjectName $acl = . .\AddProjectACL.ps1 -ProjectName $ProjectName
$r = . .\AddProjectRoles.ps1 -ProjectName $ProjectName $r = . .\AddProjectRoles.ps1 -ProjectName $ProjectName
#$ret | Add-ADGroupMember -Members $acl,$r #$ret | Add-ADGroupMember -Members $acl,$r
$acl | ForEach-Object {New-ADGroupMember -Identity $ret -Member $_} $acl | ForEach-Object {Add-ADGroupMember -Identity "$ret.DistinguishedName" -Members $_}
$r | ForEach-Object {New-ADGroupMember -Identity $ret -Member $_} $r | ForEach-Object {Add-ADGroupMember -Identity "$ret.DistinguishedName" -Members $_}
} }
return $ret return $ret