ProjectManagementScripts/GetProjectUsers.ps1

20 lines
474 B
PowerShell
Raw Normal View History

2024-07-14 11:44:34 +02:00
# Parameter help description
[CmdletBinding()]
param (
[string]
2024-07-14 13:30:12 +02:00
$Name,
[string]
$Server
2024-07-14 11:44:34 +02:00
)
if($PSBoundParameters.ContainsKey('Name')){
2024-07-14 16:57:49 +02:00
$Roles=$null
2024-07-14 13:30:12 +02:00
if($PSBoundParameters.ContainsKey('Server')){
2024-07-15 22:15:38 +02:00
$Roles = . .\GetRoles.ps1 -Server $Server | Where-Object Name -Match $Name
2024-07-14 13:30:12 +02:00
} else {
2024-07-15 22:15:38 +02:00
$Roles = . .\GetRoles.ps1 | Where-Object Name -Match $Name
2024-07-14 13:30:12 +02:00
}
2024-07-14 13:33:45 +02:00
return $Roles | Get-ADGroupMember | Get-Unique
2024-07-14 11:44:34 +02:00
}
throw "No such Project was found"