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 }