How do I bulk add guest users with display names without sending notifications?
Asked by
CuriousCoder88
I'm looking for a way to add guest users in bulk, including their display names and email addresses, but I want to do this without sending any notifications. Can anyone guide me on how to accomplish this?
Answers
You can accomplish this easily using the Graph module with PowerShell! The command **New-MgInvitation** can be used, and it has all the necessary fields you need. Just loop through a list of users that contains their display names and UPN, and send the invites without notifications. Here's a simple example:
```powershell
Foreach($user in $users){
$InviteParams = @{
InvitedUserEmailAddress = $user.UserPrincipalName
InviteRedirectUrl = "https://myapps.microsoft.com"
InvitedUserDisplayName = $user.displayName
SendInvitationMessage = $false
InvitedUserType = "guest"
}
New-MgInvitation -BodyParameter $InviteParams
}
```
This should work perfectly!
Reply to this answer
Add your answer
Answers are reviewed before publication.
HelpfulUser22: Thanks for the detailed example! It worked perfectly for me.