ProjectManagementScripts/AddProjectACL.ps1

27 lines
818 B
PowerShell
Raw Normal View History

[CmdletBinding()]
param (
[string]
$ProjectName,
[string]
$Server
)
. .\Variables.ps1
$Read = 'ACL-'+$ProjectName+'-RO'
$Write = 'ACL-'+$ProjectName+'-RW'
$ret=@()
2024-07-14 14:49:20 +02:00
if($PSBoundParameters.ContainsKey("ProjectName")){
if($PSBoundParameters.ContainsKey("Server")){
2024-07-14 16:27:01 +02:00
$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 -PassThru
2024-07-14 14:49:20 +02:00
} else {
2024-07-14 16:27:01 +02:00
$ret += New-ADGroup -Path $ACL -Name $Read -GroupCategory Security -GroupScope Global -PassThru
$ret += New-ADGroup -Path $ACL -Name $Write -GroupCategory Security -GroupScope Global -PassThru
2024-07-14 14:49:20 +02:00
}
return $ret
}
2024-07-14 14:49:20 +02:00
throw "ProjectName parameter needs to be set"