2024-07-14 14:01:22 +02:00
|
|
|
[CmdletBinding()]
|
|
|
|
param (
|
|
|
|
[string]
|
|
|
|
$ProjectName,
|
|
|
|
[string]
|
|
|
|
$Server
|
|
|
|
)
|
|
|
|
|
|
|
|
. .\Variables.ps1
|
|
|
|
|
2024-07-14 14:26:26 +02:00
|
|
|
$ret
|
|
|
|
$acl
|
|
|
|
$r
|
|
|
|
|
2024-07-14 14:01:22 +02:00
|
|
|
if($PSBoundParameters.ContainsKey("Server")){
|
2024-07-14 14:26:26 +02:00
|
|
|
$ret = New-ADGroup -Path $Projects -Server $Server -Name $ProjectName -GroupCategory Security -GroupScope Global
|
|
|
|
$acl = . .\AddProjectACL.ps1 -ProjectName $ProjectName -Server $Server
|
|
|
|
$r = . .\AddProjectRoles.ps1 -ProjectName $ProjectName -Server $Server
|
2024-07-14 14:40:45 +02:00
|
|
|
#$ret | Add-ADGroupMember -Members $acl,$r
|
|
|
|
$acl | ForEach-Object {New-ADGroupMember -Identity $ret -Member $_ -Server $Server}
|
|
|
|
$r | ForEach-Object {New-ADGroupMember -Identity $ret -Member $_ -Server $Server}
|
2024-07-14 14:01:22 +02:00
|
|
|
} else {
|
|
|
|
|
2024-07-14 14:26:26 +02:00
|
|
|
$ret = New-ADGroup -Path $Projects -Name $ProjectName -GroupCategory Security -GroupScope Global
|
|
|
|
$acl = . .\AddProjectACL.ps1 -ProjectName $ProjectName
|
|
|
|
$r = . .\AddProjectRoles.ps1 -ProjectName $ProjectName
|
2024-07-14 14:40:45 +02:00
|
|
|
#$ret | Add-ADGroupMember -Members $acl,$r
|
|
|
|
$acl | ForEach-Object {New-ADGroupMember -Identity $ret -Member $_}
|
|
|
|
$r | ForEach-Object {New-ADGroupMember -Identity $ret -Member $_}
|
2024-07-14 14:26:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return $ret
|
|
|
|
|