The WS-Management service cannot process the request

The WS-Management service cannot process the request. The user load quota of 1000 requests per 2 seconds has been exceeded. Send future requests at a slower rate or raise the quota for this user. The next request from this user will not be approved for at least X milliseconds.

I had this issue just a couple of times in Exchange 2010, but when it happens it’s a pain as you can’t run a single powershell command against exchange. Most of the resolutions I found online talked about increasing some policies or making changes in AD.

None of this is required (or at least I wouldn’t start making any change until I tried all of the soft-changes), what helped me fix the “The WS-Management service cannot process the request” problem was to restart IIS. You can do that by running a command prompt with elevated rights and type:

Note: if you have a monitoring system or load balancers that notify your entire team when HTTP/HTTPS go down, IISRESET will send in an alert.

Read More

Get Exchange Mailbox Deleted Items Folder Size

I initially wrote this post based on a simple command I used to use. That turned out to be partially wrong as sometimes it wasn’t finding the “Deleted Items” folder. After asking on technet, I told it was best to use the -FolderScope option in the command I was running. Guess what? In my environment also that turned out not to be 100% accurate. I was still left with loads of empty results. So I decided to merge the two in a script.

In order to get Exchange Mailbox Deleted Items Folder Size of an Exchange 2010’s mailbox, with the FolderScope option, run the below:

If you want to specify a folder, without giving the FolderScope and such folder is called Deleted Items, use this:

Where alias is the alias of the mailbox you’re searching against.

Problems, problems everywhere!

The above commands seems pretty simple if it wasn’t for the fact that in my environment, they didn’t always work as I said above. This is a list of issues I was getting on a few mailboxes:

  1. -FolderScope DeletedItems returns more folders than just the Deleted Items one
  2. -FolderScope DeletedItems returns no results at all
  3. where {$_.Name -eq “Deleted Items”} returns no results at all
  4. where {$_.Name -eq “Deleted Items”} returns more than one folder

Point 1 and 2

-FolderScope is great as it shrinks the amount of time needed to get such results as it doesn’t go through each folder. The problem was that sometimes, for a few mailboxes, I was getting a huge list of folders in the mailbox (note that it wasn’t a full list, I tried running Get-MailboxFolderStatistics with no filters and I was able to see more folders – for some reason they had the DeletedItems scope). Sometimes instead it seemed like the mailbox had no DeletedItems scope, which obviously didn’t return any size.

Point 2 and 4

Point 4 is obvious: the user must have created a new folder himself and called it Deleted Items! Good job! Point 3 instead is also understandable, but I didn’t think Exchange 2010 would have done this.. I’m talking of translating it into the user’s client’s language! So basically Deleted Items wasn’t found but “Elementos eliminados” was! So the criteria wasn’t met and the size was not found. Look at this mailbox for instance:

Get-MailboxFolderStatistics Deleted Items Spanish

I did run the scripts against all mailboxes and against an imported list of aliases and when running it against the entire environment, I noticed that I had about more than 10% of mailboxes missing. If I run a command against a list of mailboxes it’s because I would like to get the results in the same order, but when something isn’t found, then you get into troubles as the Export-CSV won’t add empty lines, it’ll just write back what you have (see below example of how you would run it against a text file full of MailboxGUIDs):

I needed a script that captured a few more info, but if you’re looking to get a better report that will also show you the items that have been skipped, then keep reading this.

The core of the script is this:

You will see the full script later on in this page, however I first want to show you the logic process I followed.
First of all, $identity is the MailboxGUID I gathered earlier on in the script and the first thing I run is a Get-MailboxFolderStatistics against that identity with the -FolderScope DeletedItems. This is generally pretty quick to run. If the mailbox is ok, the script is done. But if for any reason the variable $FolderSize is empty or it’s an array (which means there’s more than one result), then the script will try to run the same command, this time we’ll add the where filter and look what I did, I searched the mailboxes where I didn’t get a result and found a few translation based on the folder list. Obviously that is not all of them, so if you have more in the environment, just add them in!
If also this time $FolderSize is empty or an array, then just try to run the command again, this time excluding the -FolderScope option. This one will be the slowest command as it’ll search through the folders. This made the script much quicker, I went from a report that lasted 10.5 hours to one that lasted almost 4 (large environment).

No worries, if your environment is big enough you might end up having a few mailboxes where the script couldn’t get a size for them 🙂 . For example, let’s say that a user created a Deleted Items folder and for some reason it’s also set as a DeletedItems scope. That means the first command will catch both the original one and the new one. The second command will do the same and the third one as well. But from what I’ve seen, it’s a very special case. Instead you might have a few not being recognised. For instance I’ve seen a couple of users in Moscow showing “?????” as folder name. I just left them and didn’t mind skipping just a few.

The script

I will also leave the info I needed, I think these are handy to get a full overview of what’s going on in terms of usage in the environment. The output (C:\ExchangeReport_20151015) will include:

  • The Display Name of the user’s Mailbox
  • The Size of the Mailbox
  • The Database where the Mailbox is currently stored
  • The Deleted Items size
  • The UserAccountControl (that carries the user account state – whether it’s disabled or not and its type)
  • The OU where the user’s object is in
  • The MailboxGUID


Read More

Get the Database where a user belongs to

In Exchange 2010 SP1 it is pretty simple to get the Database where a user belongs to (or a group of users given a list). We can achieve this with PowerShell quite quickly with the following command.

Where “ALIAS” is the alias of the user you’re searching for. The command will return the Alias and the Database name. If you’ve got a list of users you want to run through (you can import a list in an external text file, in this case just for the sake of showing you how to run through each object of a list, I’m using a variable where each alias is separated by a comma) just use the below.

The above will return you the Alias and the Database of alias1, 2 and 3. Note that in this specific case I used .split(“,”). I basically told it to split the list at every comma.
The % sign instead is the abbreviation of ForEach-Object$_ is the current alias being elaborated.

Read More