2024-07-14 14:01:22 +02:00
|
|
|
[CmdletBinding()]
|
|
|
|
param (
|
|
|
|
[string]
|
|
|
|
$ProjectName,
|
|
|
|
[string]
|
|
|
|
$Server
|
|
|
|
)
|
|
|
|
|
|
|
|
. .\Variables.ps1
|
|
|
|
|
|
|
|
$Read = 'GR-'+$ProjectName+'-RO'
|
|
|
|
$Write = 'GR-'+$ProjectName+'-RW'
|
|
|
|
|
2024-07-14 16:45:30 +02:00
|
|
|
$retr=@()
|
2024-07-14 14:26:26 +02:00
|
|
|
|
2024-07-14 14:50:54 +02:00
|
|
|
if($PSBoundParameters.ContainsKey("ProjectName")){
|
|
|
|
if($PSBoundParameters.ContainsKey("Server")){
|
2024-07-14 16:45:30 +02:00
|
|
|
$retr += New-ADGroup -Path $Roles -Server $Server -Name $Read -GroupCategory Security -GroupScope Global -PassThru
|
|
|
|
$retr += New-ADGroup -Path $Roles -Server $Server -Name $Write -GroupCategory Security -GroupScope Global -PassThru
|
2024-07-14 14:50:54 +02:00
|
|
|
} else {
|
2024-07-14 16:45:30 +02:00
|
|
|
$retr += New-ADGroup -Path $Roles -Name $Read -GroupCategory Security -GroupScope Global -PassThru
|
|
|
|
$retr += New-ADGroup -Path $Roles -Name $Write -GroupCategory Security -GroupScope Global -PassThru
|
2024-07-14 14:50:54 +02:00
|
|
|
}
|
|
|
|
|
2024-07-14 16:45:30 +02:00
|
|
|
return $retr
|
2024-07-14 14:26:26 +02:00
|
|
|
}
|
|
|
|
|
2024-07-14 14:50:54 +02:00
|
|
|
throw "ProjectName parameter needs to be set"
|