From a9e9495f8a74106ff2c8d3191a67170fe4c40bed Mon Sep 17 00:00:00 2001 From: Karl-Wilfried Zimmer Date: Sun, 14 Jul 2024 13:30:12 +0200 Subject: [PATCH] snap --- GetProjectUsers.ps1 | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/GetProjectUsers.ps1 b/GetProjectUsers.ps1 index f56e8ac..5d81ec0 100644 --- a/GetProjectUsers.ps1 +++ b/GetProjectUsers.ps1 @@ -2,18 +2,21 @@ [CmdletBinding()] param ( [string] - $Name + $Name, + [string] + $Server ) if($PSBoundParameters.ContainsKey('Name')){ - . .\Variables.ps1 $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 + $Roles + if($PSBoundParameters.ContainsKey('Server')){ + $Roles = . .\GetRoles.ps1 -Server $Server | Where-Object Name -Match $Name + } else { + $Roles = . .\GetRoles.ps1 | Where-Object Name -Match $Name + } + return $Users = $Roles | Get-ADGroupMember | Get-Unique } throw "No such Project was found" \ No newline at end of file