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