$ADUserGroups = Get-AzureADUserMembership -ObjectId $AADUser.objectid Get-AzureADUserMembership : Unexpected character encountered while parsing value: T. + CategoryInfo : NotSpecified: (:), JsonReaderException $AADUser = Get-AzureADUser -filter "userprincipalname eq '$MailUPN'". Get-AzureADUser : Unexpected character encountered while parsing value: T. However, after the first failed attempt at running the script, every subsequent attempt to run the script will work just fine, until the next day when the initial run will fail again.įailed commands look like this (depending on the user): Pipiing from azureadusermembership to azureadusermanager. Some users will make it all the way through the loop, some will fail when piping from mailbox for azureaduser, some will fail when piping from azureaduser to azureadusermembership, and some will fail when TheĮxchange online commands always work with no problems. The first time I run this script every day, it always fails for several users, and it always fails one of 3 get-azuread cmdlets. It pulls a handful of users from Exchange online, pipes users to AzureAD, gets AD group membership and manager information, then pipes back to Exchange online and sets up email forwarding (though,įor testing purposes, I'm testing by having it log which users *would* be set up for forwarding in a production scenario). I have a script I want to run every day from Azure Automation.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |