added check for project name being set

This commit is contained in:
Karl-Wilfried Zimmer 2024-07-14 14:50:54 +02:00
parent 239c66befc
commit b68961cb95

View File

@ -13,6 +13,7 @@ $Write = 'GR-'+$ProjectName+'-RW'
$ret=@() $ret=@()
if($PSBoundParameters.ContainsKey("ProjectName")){
if($PSBoundParameters.ContainsKey("Server")){ if($PSBoundParameters.ContainsKey("Server")){
$ret += New-ADGroup -Path $Roles -Server $Server -Name $Read -GroupCategory Security -GroupScope Global $ret += New-ADGroup -Path $Roles -Server $Server -Name $Read -GroupCategory Security -GroupScope Global
$ret += New-ADGroup -Path $Roles -Server $Server -Name $Write -GroupCategory Security -GroupScope Global $ret += New-ADGroup -Path $Roles -Server $Server -Name $Write -GroupCategory Security -GroupScope Global
@ -22,3 +23,6 @@ if($PSBoundParameters.ContainsKey("Server")){
} }
return $ret return $ret
}
throw "ProjectName parameter needs to be set"