added project group and role getter

This commit is contained in:
Karl-Wilfried Zimmer 2024-07-14 13:01:03 +02:00
parent 4b889563b4
commit b1e447d652
3 changed files with 29 additions and 4 deletions

View File

@ -7,10 +7,12 @@ param (
if($PSBoundParameters.ContainsKey('Name')){ if($PSBoundParameters.ContainsKey('Name')){
. .\Variables.ps1 . .\Variables.ps1
$Read='GR-'+$Name+'-RO,' $Read='GR-'+$Name+'-RO'
$Write='GR-'+$Name+'-RW,' $Write='GR-'+$Name+'-RW'
Write-Host $Read+$Roles Write-Host $Read+$Roles
Write-Host $Write+$Roles Write-Host $Write+$Roles
$ReadUsers=Get-ADGroupMember -Recursive -Identity $Read
$WriteUsers
Return $null Return $null
} }

12
GetProjects.ps1 Normal file
View File

@ -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
}

View File

@ -1,3 +1,14 @@
. .\Variables.ps1 [CmdletBinding()]
param (
[string]
$Server,
)
Get-ADGroup -SearchBase $Roles $Projects
if($PSBoundParameters.ContainsKey("Server")){
$Projects = . .\GetProjects.ps1 -Server $Server
} else {
$Projects = . .\GetProjects.ps1
}
$Projects | Get-ADGroupMember | Where-Object Name -Match "GR.*"