-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
Hi,
I was wondering if it's possible to return a different property from the initial variable?
Here I am using the property displayname to build the menu (because in this case they are more readable) but what i need to extract based on the script user's input is the .userprincipalname from my initial get-msoluser command.
``function Search-User {
Param ($Question )
Write-Host $Question`n
$Answer = Read-Host "User"
$Result = Get-MsolUser -SearchString "$Answer"
switch ($Result.count)
{
{$_ -eq 0} {
Write-Host "`nUser not found!" -ForegroundColor Red
Start-Sleep -Seconds 3
$Output = $null
Break;
}
{$_ -gt 1} {
$Output = Write-Menu -Title "Select the user you want to add" -Entries $Result.DisplayName
Break;
}
Default {
$Output = $Result.UserPrincipalName
Break;
}
}
Return $Output
}``
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels