diff --git a/GetProjectUsers.ps1 b/GetProjectUsers.ps1 index ac874ca..f56e8ac 100644 --- a/GetProjectUsers.ps1 +++ b/GetProjectUsers.ps1 @@ -7,10 +7,12 @@ param ( if($PSBoundParameters.ContainsKey('Name')){ . .\Variables.ps1 - $Read='GR-'+$Name+'-RO,' - $Write='GR-'+$Name+'-RW,' + $Read='GR-'+$Name+'-RO' + $Write='GR-'+$Name+'-RW' Write-Host $Read+$Roles Write-Host $Write+$Roles + $ReadUsers=Get-ADGroupMember -Recursive -Identity $Read + $WriteUsers Return $null } diff --git a/GetProjects.ps1 b/GetProjects.ps1 new file mode 100644 index 0000000..14f6c84 --- /dev/null +++ b/GetProjects.ps1 @@ -0,0 +1,12 @@ +[CmdletBinding()] +param ( + [string] + $Server +) + +. .\Variables.ps1 +if($PSBoundParameters.ContainsKey("Server")){ + Get-ADGroups -Server $Server -SearchBase $Projects +} else { + Get-ADGroups -SearchBase $Projects +} \ No newline at end of file diff --git a/GetRoles.ps1 b/GetRoles.ps1 index 5e9fdae..e2d2df1 100644 --- a/GetRoles.ps1 +++ b/GetRoles.ps1 @@ -1,3 +1,14 @@ -. .\Variables.ps1 +[CmdletBinding()] +param ( + [string] + $Server, +) -Get-ADGroup -SearchBase $Roles \ No newline at end of file +$Projects +if($PSBoundParameters.ContainsKey("Server")){ + $Projects = . .\GetProjects.ps1 -Server $Server +} else { + $Projects = . .\GetProjects.ps1 +} + +$Projects | Get-ADGroupMember | Where-Object Name -Match "GR.*" \ No newline at end of file