Terminal Services Manager for Windows 8

For some reasons Microsoft has removed such a useful tool from RSAT (Remove Server Administration Tools) for Windows 8 and 8.1 and it’s not on Windows 2012 and 2012 R2 server either. Looking around on the internet I haven’t found many people posting a concrete solution that allowed us to use the Microsoft Terminal Services Manager for Windows 8+.

I prefer to avoid installing a 3rd party tool when Microsoft had a good application that could achieve that. Some people on forums said “why don’t you just use task manager?”. Well these people clearly never worked in a large environment 🙂 .
The thing I liked the most about the Terminal Services Manager is the way I could create groups and look at all of the sessions from different servers in the same screen (still thinking about the guy who proposed to use task manager..).


Yup 🙂 There’s one and it worked on my Windows 8.1 system. Other people have reported that this solution works on Servers too but to be honest, I would not apply such a solution to a server. You can, but I won’t 🙂 .
I’m not sure yet whether the files required are the same on both x64 and x86 OS, I’ve done this by getting the files from a 2008 R2 (x64) machine and applied them on my Windows 8.1 x64 laptop.

  1. On a 2008 SP2/2008 R2 Server get the following files from C:\Windows\System32 [%systemroot%\System32]:
    Note: When I did it, I already had umcRes.dll in System32 and I decided not to overwrite it.
  2. Copy them all in C:\Windows\System32 on the machine running Windows 8 (or 8.1, Server 2012/2012 R2).
  3. Copy and paste the below code in notepad and save it as a .reg file:
  4. Double click on the reg file you just created on the target machine in order to add these keys to the registry.
  5. Done! You can now start %systemroot%\System32\tsadmin.msc

Download the files

In case you do not have access to an old 2008 box, no worries, below is the zip file with those files in it (from a 2008 R2 – x64 machine). I’ve also included add_TSadmin.reg in it which takes care of step 3 for you.

Click here to Download Terminal Services Manager

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

Lync 2013 silent install

Performing a Lync 2013 silent install isn’t as easy as it was with Lync 2010, especially if the application you’re trying to install was downloaded from the Volume License website.
I’m not sure if the issue I had trying to perform a Lync 2013 silent install applies to all version of Lync 2013. The problem I had was that after I created a customised MSP file (keep reading to see how to do that) and started the installation silently, Lync was not there! I could see it in Add/Remove Programs, but I couldn’t see it anywhere else. Not even when I searched in Start: this problem occurred on both Windows 7 and 8.1. Note that I’ve only tried with the 32bit version (also SP1) as that’s the one I need to deploy (also to machines running Windows x64).

After searching for a while I finally got to a download page on the Microsoft website:

Basically this file contains updated Office Customization Tool (OPAX/OPAL) files for Microsoft Office 2013.
Once you have downloaded the file, run it (it’s a self extractor .exe file) and choose the location where to extract the files.
Navigate to the location where you extracted those files and copy the admin folder in the root of the Lync 2013 installation folder and overwrite all existing files and folders.

Microsoft Office Customization Tool admin folder

Once you’ve done that, you’re good to re-create the MSP file for a customised Lync 2013 silent install. If you already have the old MSP file you created earlier with the original Lync 2013 installation, you must import it and save it back again.

If you’re here just to see how to create a Lync 2013 silent install MSP file, this is the moment 🙂 .
Let’s suppose the content of the Lync 2013 installation is in C:\temp\Lync 2013\x86.

Run the following command (you can also do it in “Run”):

This will open up the tool that will allow us to customise the installation. You’ll be prompt to select the version of the application you want to customise and then you’ll be good to start using the Microsoft Office Customization Tool.


What I generally modify is the Organization name under Install location and organization name.


This is the most important part which will allow Lync to be installed silently. Firstly choose whether you’re going to use a KMS server or just type the product key in. Secondly, you want to accept the terms and conditions and finally select None as Display Level (or just make sure the Suppress modal is selected).



Read More

Get a list of services that depend on the specified service

In this post, I’m going to avoid PowerShell for a simple reason: I’ve got to fix SCCM client issues and to do that, I will need to run a script on each one of these clients. As the number of client is in the hundreads, imagine trying to run a script that is compatible with many PS versions (and this is not the difficult part), when PowerShell is installed! I’m sure the support guys will have to run through a few XP machines 🙁 .
Another issue wiht PS is that I would need to change the execution policy on each client. No thanks, for now at least.
If you didn’t hear enough excuses, here’s another one: yep I could run PS remotely using WMI but guess what? I need to work on stopping WMI and the services that depend on it.

I opted for a simple command line that will get a list of services that depend on the specified service:

For instance, let’s try to run this against WMI (Windows Management Instrumentation – winmgmt):

This is the result against one of my machines.

sc enumdepend winmgmt output

Now, I am a big fan of AutoIt, so I’ll be using it to capture the output from this command and have it to get a list of services that depend on the specified service, which in my case will be winmgmt. AutoIt gives me less troubles as in the end it’ll all be compiled in a single executable file. In the script below I kept a higher number of variables so that if you’re interested, you can just modify the script and start using the variable you like the most (for instance $temp_array in the script could be avoided). Normally I would have saved a couple of lines from it.

I tried to comment as much as I could to make it as simple as possible. As you can see, you can now use the content from the array names $services and for instance, run through them all in a for cycle and stop all of these services.

I personally added this to another script that will basically will try to fix the issues with the SCCM clients in the environemt. I’ll probably write an article that’ll describe the steps to do that. Obviously in my case I removed any output (MsgBox) and wrote a log instead as I will need to have the Desktops team to run this remotely and silently.

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