Office365: Draft Emails Created in Inbox

Aaand again…another CRAZY Office365 issue solved, with a resolution out of left field. In this case, the user was having problems when replying to emails; not only did the email get delivered as usual, and the usual sent item was created in Sents, but the original email in the INBOX was being converted to a DRAFT! So if I sent him an email, and he replied to me, I’d get the reply as usual, but my original email, in his inbox, was turning into a draft.

In addition, he complained that his calendar was out-of-sync; things on his phone weren’t showing up in Outlook.

Continue reading “Office365: Draft Emails Created in Inbox”

Getting a full list of Exchange Online Powershell Commands

Again, I love to share things that seem to take a bunch of searching for, and in this case, trying to find a full list of commands when administering Exchange online/Office365 via Powershell. You won’t ever find a list really, because they’re changing all the time and may also be dependent on the type of tenant you have amongst other factors.

Continue reading “Getting a full list of Exchange Online Powershell Commands”

Problem using Invoke-Webrequest in a Powershell task on Windows Server

I figured I’d share this one, since it’s one of those fun Microsoft-isms that just like to pop up on a rainy Friday. I had a script that runs on a server, that I had to modify to grab some info off a web page using Invoke-Webrequest. Super simple basic request with no auth. Added it to the script, run the script on the server, works great, life is good!

Continue reading “Problem using Invoke-Webrequest in a Powershell task on Windows Server”

OneDrive – “The Documents folder contains other important folders…”

Yet another dreaded hurdle trying to enable OneDrive “Backup” (previously labeled as KFM, or “Known Folder Move”). When trying to enable OneDrive backup, you get an error: “The Documents folder contains other important folders and isn’t supported for file protection.”

Issue setup OneDrive for Business Folder Protection - Microsoft Community
Continue reading “OneDrive – “The Documents folder contains other important folders…””

Powershell – Getting Group Membership in Office365

As I’m trying to clean up some accounts, I found that it’s -not easy- to simply get a list of all the groups a user is a member of in powershell, at least not like the one that displays in the admin portal. In doing some hunting (admittedly, not a lot of hunting) I came across this site that has just about what I was looking for, but I will warn you that the one-liners provided are not efficient – they have to populate the members of all groups, therefore if you have a LARGE directory, these may take a very long time to run, and be data-intensive. If you’re an SMB or SME with only a couple hundred users, they should be OK.

https://absolute-sharepoint.com/2018/03/find-all-the-office-365-groups-a-user-is-a-member-of-with-powershell.html?unapproved=397014&moderation-hash=b59b197881609389d441464bd17d72bb#comment-397014

The problem was, it didn’t work! It looked good, but the variable it stored the results in was empty. After a quick review I realized the problem; the $mailbox.Alias at the end of the scripts should have been $mailbox.Name, since the alias will never match the name shown in the group membership. Once I changed that, it worked as it should:

$Office365GroupsMember = Get-UnifiedGroup | where { (Get-UnifiedGroupLinks $_.Alias -LinkType Members | foreach {$_.name}) -contains $mailbox.Name}

However…this only works for “Office365” Groups, and not all Office365 group types, that may include groups sync’ed from Active Directory/DirSync, like distribution lists and so on. I took the one-liner from that site, and modified it slightly to use “get-msolgroup” rather than get-unifiedgroup, which worked as it should.

$UserEmail= "someperson@somecompany.com"
 
$Mailbox = Get-Mailbox | Where {$_.PrimarySmtpAddress -eq $UserEmail}

Get-msolGroup | where { (Get-msolGroupmember -GroupObjectId $_.objectid | foreach {$_.displayname}) -contains $mailbox.name}

From there you can pipe the output of that command into others, like remove-msolgroupmembership (although it needs the member objectid which is odd), or store it in a variable. Keep in mind you may want to filter group types as well, as I’m not sure you can remove a user from an Office365 group that was added/created as part of a Teams teams.

Last but not least, see these commands to do simliar roles for Active Directory:
get-adprincipalgroupmembership
remove-adprincipalgroupmembership

I figured this might help someone out, and kudos to the other page for having a one-liner that worked as the basis for this!