From 239c66befc956d5f2e205b8017ebd55ae98e2b0c Mon Sep 17 00:00:00 2001 From: Karl-Wilfried Zimmer Date: Sun, 14 Jul 2024 14:49:20 +0200 Subject: [PATCH] added check for project name being set --- AddProjectACL.ps1 | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/AddProjectACL.ps1 b/AddProjectACL.ps1 index 85d276c..8526ee2 100644 --- a/AddProjectACL.ps1 +++ b/AddProjectACL.ps1 @@ -13,12 +13,15 @@ $Write = 'ACL-'+$ProjectName+'-RW' $ret=@() -if($PSBoundParameters.ContainsKey("Server")){ - $ret += New-ADGroup -Path $ACL -Server $Server -Name $Read -GroupCategory Security -GroupScope Global - $ret += New-ADGroup -Path $ACL -Server $Server -Name $Write -GroupCategory Security -GroupScope Global -} else { - $ret += New-ADGroup -Path $ACL -Name $Read -GroupCategory Security -GroupScope Global - $ret += New-ADGroup -Path $ACL -Name $Write -GroupCategory Security -GroupScope Global +if($PSBoundParameters.ContainsKey("ProjectName")){ + if($PSBoundParameters.ContainsKey("Server")){ + $ret += New-ADGroup -Path $ACL -Server $Server -Name $Read -GroupCategory Security -GroupScope Global + $ret += New-ADGroup -Path $ACL -Server $Server -Name $Write -GroupCategory Security -GroupScope Global + } else { + $ret += New-ADGroup -Path $ACL -Name $Read -GroupCategory Security -GroupScope Global + $ret += New-ADGroup -Path $ACL -Name $Write -GroupCategory Security -GroupScope Global + } + return $ret } -return $ret \ No newline at end of file +throw "ProjectName parameter needs to be set" \ No newline at end of file