From 3dfa7a0e5858f89e7140b6f38ac6fb4d720aabfd Mon Sep 17 00:00:00 2001 From: Karl-Wilfried Zimmer Date: Sun, 14 Jul 2024 14:40:45 +0200 Subject: [PATCH] added missing server param for adgroupmember --- NewProject.ps1 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/NewProject.ps1 b/NewProject.ps1 index 59c103b..601273d 100644 --- a/NewProject.ps1 +++ b/NewProject.ps1 @@ -16,13 +16,17 @@ if($PSBoundParameters.ContainsKey("Server")){ $ret = New-ADGroup -Path $Projects -Server $Server -Name $ProjectName -GroupCategory Security -GroupScope Global $acl = . .\AddProjectACL.ps1 -ProjectName $ProjectName -Server $Server $r = . .\AddProjectRoles.ps1 -ProjectName $ProjectName -Server $Server - $ret | Add-ADGroupMember -Members $acl,$r + #$ret | Add-ADGroupMember -Members $acl,$r + $acl | ForEach-Object {New-ADGroupMember -Identity $ret -Member $_ -Server $Server} + $r | ForEach-Object {New-ADGroupMember -Identity $ret -Member $_ -Server $Server} } else { $ret = New-ADGroup -Path $Projects -Name $ProjectName -GroupCategory Security -GroupScope Global $acl = . .\AddProjectACL.ps1 -ProjectName $ProjectName $r = . .\AddProjectRoles.ps1 -ProjectName $ProjectName - $ret | Add-ADGroupMember -Members $acl,$r + #$ret | Add-ADGroupMember -Members $acl,$r + $acl | ForEach-Object {New-ADGroupMember -Identity $ret -Member $_} + $r | ForEach-Object {New-ADGroupMember -Identity $ret -Member $_} } return $ret