Skip to content

Commit a6a6587

Browse files
emmanuel-karanjaKenitoInc
authored andcommitted
Updates
1 parent e49b3e3 commit a6a6587

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

module/EntraBeta/Microsoft.Entra.Beta/Users/Update-EntraBetaInvitedUserSponsorsFromInvitedBy.ps1

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ function Update-EntraBetaInvitedUserSponsorsFromInvitedBy {
99
param (
1010

1111
# 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') })]
1314
[String[]]
14-
$userId,
15+
$UserId,
16+
1517
# 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.")]
1719
[switch]
18-
$all
20+
$All
1921
)
2022

2123
begin {
@@ -26,17 +28,12 @@ function Update-EntraBetaInvitedUserSponsorsFromInvitedBy {
2628

2729
$customHeaders = New-EntraBetaCustomHeaders -Command $MyInvocation.MyCommand
2830

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) {
3532
#TODO: Change to Get-EntraBetaUser when -ExpandProperty is implemented
3633
$invitedUsers = Get-MgUser -Filter $guestFilter -All -ExpandProperty Sponsors
3734
}
3835
else {
39-
foreach ($user in $userId) {
36+
foreach ($user in $UserId) {
4037
#TODO: Change to Get-EntraBetaUser when -ExpandProperty is implemented
4138
$invitedUsers += Get-MgUser -UserId $user -ExpandProperty Sponsors
4239
}

0 commit comments

Comments
 (0)