ProjectManagementScripts/AddProjectRoles.ps1
2024-07-14 16:27:01 +02:00

28 lines
825 B
PowerShell

[CmdletBinding()]
param (
[string]
$ProjectName,
[string]
$Server
)
. .\Variables.ps1
$Read = 'GR-'+$ProjectName+'-RO'
$Write = 'GR-'+$ProjectName+'-RW'
$ret=@()
if($PSBoundParameters.ContainsKey("ProjectName")){
if($PSBoundParameters.ContainsKey("Server")){
$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 -PassThru
} else {
$ret += New-ADGroup -Path $Roles -Name $Read -GroupCategory Security -GroupScope Global -PassThru
$ret += New-ADGroup -Path $Roles -Name $Write -GroupCategory Security -GroupScope Global -PassThru
}
return $ret
}
throw "ProjectName parameter needs to be set"