File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed
module/EntraBeta/Microsoft.Entra.Beta/Users Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -9,13 +9,15 @@ function Update-EntraBetaInvitedUserSponsorsFromInvitedBy {
9
9
param (
10
10
11
11
# UserId of Guest User
12
- [Parameter (ParameterSetName = ' ByUsers' , HelpMessage = " The Unique ID of the User (User ID)." )]
12
+ [Parameter (ParameterSetName = ' ByUsers' , HelpMessage = " The Unique ID of the User (User ID)." )]
13
+ [ValidateScript ({ ($_ -ne $null -and $_.Count -gt 0 ) -or $PSCmdlet.MyInvocation.BoundParameters.ContainsKey (' All' ) })]
13
14
[String []]
14
- $userId ,
15
+ $UserId ,
16
+
15
17
# Enumerate and Update All Guest Users.
16
- [Parameter (ParameterSetName = ' AllInvitedGuests' , HelpMessage = " A Flag indicating whether to include all invited guests." )]
18
+ [Parameter (ParameterSetName = ' AllInvitedGuests' , HelpMessage = " A Flag indicating whether to include all invited guests." )]
17
19
[switch ]
18
- $all
20
+ $All
19
21
)
20
22
21
23
begin {
@@ -26,17 +28,12 @@ function Update-EntraBetaInvitedUserSponsorsFromInvitedBy {
26
28
27
29
$customHeaders = New-EntraBetaCustomHeaders - Command $MyInvocation.MyCommand
28
30
29
- if ($null -eq $userId -and ! $all ) {
30
- Write-Error " Please specify either -UserId or -All"
31
- return
32
- }
33
-
34
- if ($all ) {
31
+ if ($All ) {
35
32
# TODO: Change to Get-EntraBetaUser when -ExpandProperty is implemented
36
33
$invitedUsers = Get-MgUser - Filter $guestFilter - All - ExpandProperty Sponsors
37
34
}
38
35
else {
39
- foreach ($user in $userId ) {
36
+ foreach ($user in $UserId ) {
40
37
# TODO: Change to Get-EntraBetaUser when -ExpandProperty is implemented
41
38
$invitedUsers += Get-MgUser - UserId $user - ExpandProperty Sponsors
42
39
}
You can’t perform that action at this time.
0 commit comments