Sharepoint Error – User Not in Directory

Had an odd one today. An internal user with permissions to a Sharepoint site was getting the error “user not in directory”. Searching Google comes up with many different options and reasons for this error, but no concise cause / solution.

The user was able to login to Office365 webmail normally without any errors and was had a Sharepoint license for several weeks and hadn’t reset their password recently.

Eventually, I had the user un-invited and then re-invited and it worked!

MailboxImportRequest Fails

I ran into an issue with a Powershell script I wrote recently, where I received this error:

The name must be unique per mailbox. There isn’t a default name available for a new request owned by mailbox xyz

Basically, a record is kept for completed mailbox move requests, and if you do too many for one mailbox, you get the above error. Don’t worry! Just run the following command in PS to clear away the completed request records, and you’ll then be able to run the import request!

 

Get-MailboxImportRequest -Status Completed | Remove-MailboxImportRequest

That’s it!

How To: Disable Clutter in Office365

To disable Clutter in Office365 via Powershell, simply do the following:

Connect to Office365 Powershell for your account

Then simply run this command to disable Clutter for all mailboxes:

Get-Mailbox | Set-Clutter –enable $false

That’s it! If you want to disable Clutter for a single mailbox, you can do the following:

Set-clutter -identity user@email.com-Enable $false

To do this via the Office365 Portal, just navigate to: Mail > Automatic Processing > Clutter and turn it off!

How to Find Last Logon Time for Exchange Mailbox Users

The last logon time of an Exchange 2010/2013/2016 mailbox user can easily be found by running the Get-MailboxStatistics cmdlet in the Exchange Management Shell.

 

You can further sort the info by including and running the following command:

Get-MailboxStatistics -Server EXCH | Sort LastLogonTime -Descending

And export it to a CSV by adding an Export-CSV option like below:

Get-MailboxStatistics -Server EXCH | Sort LastLogonTime -Descending | Export-CSV c:\lastlogon.csv

Editing Calendar Permissions in Office365 via Powershell

First you need to connect to Office365.

Next, simply run this commandlet:
Add-MailboxFolderPermission calendar@company.com:\Calendar User guy@company.com AccessRights Author

Your accessrights options are: Owner, PublishingEditor, Editor, PublishingAuthor, Author, NonEditingAuthor, Reviewer, Contributor, AvailabilityOnly, LimitedDetails

If you’d like to get permissions, you can simply use:
Get-MailboxFolderPermission Identity calendar@company.com:\Calendar User guy@company.com

Finally, to remove permissions:

RemoveMailboxFolderPermission Identity calendar@company:\calendar user dude@company.com

Disable the Calendar on a User or Shared Mailbox In Exchange

This works for Office365 or an internal Exchange server to disable the calendar on a Shared Mailbox or User’s Mailbox. First, you’ll have to pull up the Exchange Management Shell. Then run the following commands:

New-OwaMailboxPolicy –Name “New Policy Name”

Creates a new mailbox policy


Set-OwaMailboxPolicy –Identity “New Policy Name” –CalendarEnabled $false

Sets the calendar for all mailboxes under the policy to be off

Set-CASMailbox –Identity “shared mailbox” –OwaMailboxPolicy “newpolicy”

Applies the policy to the mailbox in question

 

Generate Mailbox Size and Usage Report using PowerShell for Exchange 2010 / 2013

An easy way to get a mailbox usage report is via the Get-Mailboxstatistics commandlet in powershell and a combination of other commands. The below script will output a mailbox usage report in HTML format:

 

Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Select DisplayName,
TotalItemSize,ItemCount,Database,LastLogonTime,LastLoggedOnUserAccount | Sort
TotalItemSize -Descending | ConvertTo-Html -Title "Mailbox Stats"|
Out-file "C:\MailboxStats.html"

Exchange 2010 Add Mailbox Folder Permissions including Subfolders

I was asked by a user today for access to a specific folder in an old user’s mailbox within Outlook. There were no free computers and so the easy way out of setting up Outlook with the mailbox was not an option. I fired up Google and found this handy script for use in the Exchange Console:

ForEach($folder in (Get-MailboxFolderStatistics AliasofSharer| Where { $_.FolderPath.ToLower().StartsWith(“/Invoices“) -eq $True } ) )
{
$foldername = “AliasofSharer:” + $folder.FolderPath.Replace(“/”,”\”);
Add-MailboxFolderPermission $foldername -User AliasofRequestor-AccessRights PublishingEditor
}

  1. Change the name of the folder to be shared to where Invoices is here: ‘FolderPath.ToLower().StartsWith(“/Invoices“)’
  2. Change ‘AliasofSharer’ to the alias of the user who will be sharing the folder
  3. AliasofRequestor is who will be given access to said folder
  4. In the above example I’ve used PublishingEditor but this can be changed as required.

Blocking Cryptolocker and Crypto Viruses in Office365

In Office365, you can setup a rule that blocks attachments with executable content… namely attachments that are EXE files OR things like zip files with EXE, bat, etc. content within. This is something Google Apps automatically does, but Exchange / Office365 does not and requires manual intervention.

To do this, you have to go into the Exchange Admin Center, go to Mail Flow, create a new rule, hit “more options”, and then use the following settings:

cryptoblock

Save it and you’re golden!

 

Death, Taxes, and… Web Designers

There aren’t many guarantees out there in the IT world, but I’ve found that without fail, web designers will ALWAYS manage to screw up MX records when doing work in a web domain’s DNS settings.

Last week for instance, I was told a client was getting a new website. I immediately warned them about the track record many web designers have when doing things like this. The client immediately emailed the web designer, in Australia, about being careful. The reply was as follows:

[Client XYZ] email records won’t be altered as we’re only interested in the web hosting information

Suffice to say, less than five hours later I saw this when doing an MX lookup to see if this web designer was any different than the others:

Webdesignershavoc