From 27548c5dc5af2bf2f5b4960b4768aea996560e41 Mon Sep 17 00:00:00 2001 From: Karl-Wilfried Zimmer Date: Sun, 14 Jul 2024 17:15:12 +0200 Subject: [PATCH] new project now links GR to ACL --- NewProject.ps1 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/NewProject.ps1 b/NewProject.ps1 index cb5b813..42b5fd6 100644 --- a/NewProject.ps1 +++ b/NewProject.ps1 @@ -8,6 +8,10 @@ param ( . .\Variables.ps1 +$ret=$null +$acls=$null +$rs=$null + if($PSBoundParameters.ContainsKey("ProjectName")){ if($PSBoundParameters.ContainsKey("Server")){ $ret = New-ADGroup -Path $Projects -Server $Server -Name $ProjectName -GroupCategory Security -GroupScope Global -PassThru @@ -27,6 +31,24 @@ if($PSBoundParameters.ContainsKey("ProjectName")){ $rs | ForEach-Object {Add-ADGroupMember -Identity $ret -Members $_} } + if($PSBoundParameters.ContainsKey("Server")){ + $target = $acls | Where-Object Name -Match ".*RW" + $member = $rs | Where-Object Name -Match ".*RW" + Add-ADGroupMember -Identity $target -Members $member -Server $Server + $target = $acls | Where-Object Name -Match ".*RW" + $member = $rs | Where-Object Name -Match ".*RW" + Add-ADGroupMember -Identity $target -Members $member -Server $Server + } else { + $target = $acls | Where-Object Name -Match ".*RW" + $member = $rs | Where-Object Name -Match ".*RW" + Add-ADGroupMember -Identity $target -Members $member + $target = $acls | Where-Object Name -Match ".*RW" + $member = $rs | Where-Object Name -Match ".*RW" + Add-ADGroupMember -Identity $target -Members $member + } + + + return $ret }