Category Archives: Windows

Get Monitor Size programmatically

Hello everyone,

today I want to show you how you can use C# to get the physical size of a monitor in inches. This can be helpful if you need to know the physical size of a monitor and you do not know where it is located or if you want to get a list of average monitor sizes in your company.

All you need to do to make this work is the below code snippet:

using System;
using System.Management;

namespace GetScreenSize
    class Program
        static void Main(string[] args)
            //Get monitor data
            ManagementObjectSearcher searcher = new ManagementObjectSearcher(@"\root\wmi", @"SELECT * FROM WmiMonitorBasicDisplayParams");

            //Calculate and output size for each monitor
            foreach (ManagementObject managementObject in searcher.Get())
                //Calculate monitor size
                double width = (byte)managementObject["MaxHorizontalImageSize"] / 2.54;
                double height = (byte)managementObject["MaxVerticalImageSize"] / 2.54;
                double diagonal = Math.Sqrt(width * width + height * height);

                //Output monitor size
                Console.WriteLine("Monitor Size: {0:F1}\"", diagonal);


If you have multiple monitors connected to your computer the above code will output the size of each monitor.

Important: You need to add a reference to System.Management to make the above code work.

Well, that´s it. Now you are able to get the physical size of your monitor without having to measure it.
I hope you liked my post and I hope to see you again next time 🙂

As always you can download my code from here.


Tagged ,

Connect to Wireless Display dongle

Hello everyone,

today I want to show you a little project I have been working on 🙂

The project:

My father was searching for a way to watch videos and pictures on his big TV screen. (To watch YouTube Videos or show family pictures to his friends, etc.) Since his TV is not the newest one and I wanted to keep it as simple as possible for him I came up with this idea:

Use a tablet PC as the core component and a Wireless display dongle to mirror the tablet PCs screen. This way the tablet PC is both: The computer and the remote control.

Here is the hardware I used:

TrekStor SurfTab wintron 7.0 as the tablet PC.

VicTsing 2,4 G HDMI Miracast Dongle as the Wireless display dongle.


How I did it:

As you may know many tablet PCs have a “Windows Key” which, in my opinion, is not very useful in its default state. It opens the Windows Start Menu like every normal Windows Key on a standard keyboard but how often do you need this on a tablet? (It makes more sense on tablet PCs which have a hardware keyboard because you can use keyboard shortcuts but most of the cheap tablet PCs do not have a hardware keyboard.) So I thought: Why not reuse it for an other purpose? So I used AutoHotkey to remap the Windows Key to a custom script I wrote. (I got this idea after reading this post on stackoverflow. The user jaredbaszler published a great AutoHotkey script to connect to a specific Wireless display dongle which inspired me to write my own AutoHotkey script for this project.)

And here is the script which will connect our tablet PC to our Wireless display dongle: (Please keep in mind that this script will only work as expected if you have only 1 Wireless display dongle up and running. If you have multiple Wireless display dongles please have a look at jaredbaszler´s script here.)

Send #k ; Sends Windows button + K to open the Action Center Connect window
Sleep, 3000 ; Wait some time so the wireless display dongle can be found
Send {Enter} ; Send ENTER key to connect to wireless display dongle (works when only 1 is found)
Send {Esc} ; Send ESC key to close the Action Center Connect window

This is what the script does:

Every time the user touches the Windows Key it will do the following:

  1. First it will press WIN+K which will open the Action Center Connect window
  2. Then it will wait for 3 seconds so that the wireless display dongle can be found (You can adjust this value as you please but I needed to wait more than 2 seconds for my wireless display dongle to show up)
  3. After the wait it will press ENTER which will automatically choose the first wireless display dongle in the list and trigger the connect function (If no wireless display dongles can be found your Default Browser will open the “Help” link)
  4. The last thing the script does is to press the ESC key to close the Action Center

Please keep in mind that this will always result in connecting to the Wireless display dongle which shows up first in the Connect window. If you are already connected to a Wireless display dongle touching the Windows Key again will result in a disconnect. (I copied the explanation from my answer from stackoverflow to save some time.)

Automate the script:

The last thing we need to do is to run the script every time the user logs on. I did it by configuring a new Task in the Task Scheduler.

Choose a name for your Task.

Now choose a Trigger. (I chose to run the Task at user log on.)


Now simply choose the ActionStart a program” and set the path to your script.


Next have a look at the Conditions. You will want to uncheckStart the task only if the computer is on AC power.“. Most of the time your tablet PC will not be connected to your power supply when you use it.


The Settings tab will allow you to define the behavior of your Task.


Click on OK and you are ready to go.

Tip: If you do not want to install AutoHotkey on your tablet PC you can convert your scripts to executable files by following this guide here.

Well, that´s it. I hope you liked my post and I hope to see you next time 🙂



Tagged ,

Windows 10 – Create new Local User Account

Hello everyone,

welcome to my first post of the year 2016. I hope you had a happy Christmas and a happy new years eve 🙂

Today I´m going to show you how you can simply create a new local user account in Windows 10 if you need one. You may ask yourself why I am writing a post about something as simple as that but let me tell you: Microsoft changed the way to create local users in Windows 10 and therefore this task is not as simple as it was in Windows 7 anymore.

Posts like this one from How-To Geek explain pretty good how creating users works now in Windows 10. In my opinion this is too much hassle for a simple requirement like this. Please Microsoft implement something like a simple “Add Button” for local user accounts.

Ok. Although the process of creating a new local user account got more difficult on the GUI than it used to be you will be happy to hear that it still takes only seconds on the command line. Here is what you need to do to create a new local user:

Run cmd as Administrator.

net user <Username> <Password> /add

Well, that´s it. You have successfully created a new local user account 🙂

Deleting a user account is just as simple:

net user <Username> /del

As you can see the good old command line is always there to help 🙂

I hope my post was useful for you and I hope to see you again next time 🙂


Tagged ,

Export and Import WLAN Profiles

Hello everyone, today I want to show you how you can transfer your WLAN Profile data to another computer. Here is the story behind this post: A few days ago my brother bought a new laptop and asked my if I know a comfortable way to teach his new laptop all necessary information it needed to automatically connect to his WLAN networks like his old laptop did since he did not want to connect to all needed WLAN networks again and enter all the passwords again. So, he basically asked me to configure his new laptop so that it would automatically connect to his WLAN networks at home, at his friends or at work like his old one did. Well, thanks to Google and some great posts mentioned in the Sources below I was able to do this and I will show you how you can do it.

Ok. Let´s begin 🙂

The first thing you need to do is to run cmd as Administrator.

Next run the following command to get a list of all WLAN network profiles saved on your computer:

netsh wlan show profiles

Next run the following command to export a specific WLAN network profile:

netsh wlan export profile "YourSSID" key=clear folder="C:\Users\You\Desktop"

The above command will create an XML file like this:

<?xml version="1.0"?>
<WLANProfile xmlns="">

Now transfer the above file to the computer (I´ll call it computer B) where you want to import the WLAN profile data.

Now run cmd as Administrator on computer B.

To import the WLAN profile run the following command: (The command will import the data for all users. If you want only your current user to get the data replace “user=all” with “user=current”)

netsh wlan add profile filename="C:\Users\You\Desktop\Wi-Fi-YourSSID.xml" user=all

Well, that´s it. Computer B has now all the necessary information about the WLAN network to connect to it.

I hope you liked my today´s post and I hope to see you again next time 🙂


Tagged ,

Raspberry Pi 2 – Windows 10 IOT Installation

Hello everyone, today I came across a great post on reddit which explains how to install Windows 10 IOT on your Raspberry Pi 2 in the most simple way I have seen so far. And I will show you how you can install the current Windows 10 IOT Build so you can lay your hands on this new topic as soon as possible 🙂

To download the new Windows 10 IOT you first need a Microsoft Account. Then click on this link to sign up on Microsoft Connect.

After you have successfully signed up for Microsoft Connect download the file ““.

Now if you don´t have the Windows 10 Insider Preview Operating System installed on your computer or on a virtual machine, don´t worry: You don´t need it. The only thing yo need is a 7zip file called “DISM10074.7z” which you can download from here. (You can find the original post where this file comes from in this reddit thread here.)

Important: Don´t forget to unblock the “DISM10074.7z” file before you unzip it.


Next unzip the above zip files. In “Windows_IoT_Core_RPI2_BUILD” you will find the file “Flash.ffu“. Place this file into the “DISM10074” directory you extracted from the second zip file.


Next run PowerShell as Administrator and use the command “cd” to change into your “DISM10074” directory.

Now insert your Micro SD Card (at least 8GB) and start diskpart with the below command.


Now find out the Disk number of your Micro SD card by using the below command:

list disk

Write down the Disk number of your Micro SD Card and exit diskpart.


Now for the last step. Run the below command to write the Windows 10 IOT image to your Micro SD card:

Important: Replace the X of PhysicalDriveX with the number of your Disk before you run the below command.

.\dism.exe /Apply-Image /ImageFile:flash.ffu /ApplyDrive:\\.\PhysicalDriveX /SkipPlatformCheck

Wait for the command to complete. If it says “The operation completed successfully” everything went as expected.

Now you can close the PowerShell window and safely remove your Micro SD card and you are ready to use Windows 10 IOT.

Insert your Micro SD card into your Raspberry Pi 2 and plug in all necessary cables. Please keep in mind that the first boot will take some time so please be patient and don´t turn off your Raspberry Pi 2.

Well, that´s it. You can now start to explore Windows 10 IOT. Have fun!

I hope my post was interesting for you and I hope to see you again next time 🙂


Tagged ,

Windows God Mode

Hello everyone, today I want to show you something neat you can use to simplify Administration of your Windows Systems. This neat little trick is called “God Mode”. Well, it does not provide you with the powers of a god but it delivers you a useful toolbox with almost all settings you need to efficiently administrate your Windows System. This is especially useful on Windows 8 and Windows 8.1 Systems if you are like me and struggle with the new interface.

Ok, here are the steps to create your own God Mode Shortcut:

First you need to create a new folder.


Next think of a good name for your God Mode Shortcut and append the following string:


For example I called my God Mode Shortcut “AllSettings”:



When you hit enter you will notice that the folder icon will change immediately into the Control Panel icon:


Double click on it to open the Settings window:


Well, that´s it. You now have a neat little toolbox with a lot of useful settings set up in less than 1 minute. Pretty cool, right?

I hope my post was useful for you and I hope to see you again next time 🙂



Windows Server – Setup Mail Server for Development environment

Hi everyone. Today I want to show you how you can set up a simple Mail Server for your development environments.

To set up a simple Mail Server you need to do the following:

  • Setup Windows Server 2008R2 and give it a name you can easily remember (I chose as name for my server)
  • Download Visendo SMTP Extender from here.

Installation of SMTP Server feature

Install the Windows Feature SMTP Server.


Now open IIS 6 Manager.


Now select [SMTP Virtual Server #1] and click on Properties.

Now go to the Access tab and click on Relay…

Now make sure to enable the setting All except the list below and make sure to check the checkbox at the end of the window and click OK.


Now go to the Delivery tab and click on Advanced…

The name of your server (the name of mine is will be entered in the Fully-qualified domain name text box. If not make sure to enter it and click on OK.


Now open up Services and make sure the Startup Type of the service Simple Mail Transfer Protocol is set to Automatic.


Installation of Visendo SMTP Extender

The Installation is pretty simple. Simply download the Installer mentioned above and run the Setup Wizard.

After the installation has finished open up the Visendo Configuration Wizard.


Now create a new account.


After you have created your accounts go to Settings and click on Start.


Now go to Services and make sure that the Startup type of the service Visendo SMTP Extender is set to Automatic.


Configuration of Windows Firewall

To make sure that your Mail Server will work as expected you need to allow POP3.

Create a new Inbound Rule in Advanced Settings of Windows Firewall.

Choose Port and click on Next.


Now choose TCP and enter 110 in the Specific local ports text box.


Now choose Allow the connections.


In the last step I checked Domain, Private and Public.


Client Setup

On your client machine start Microsoft Outlook.


Now choose Yes and click on Next.


Now choose Internet E-mail and click on Next.


Now choose Manually configure server settings or additional server types and click on Next.


Now enter your account information like shown in the below screenshot and click on Next.


Now Microsoft Outlook will check if it is able to connect to your Mail Server and send an test E-mail.


If all tests are successful your configuration is finished and you are ready to go.


That´s it. Your Mail server and your client are now ready to use.



BranchCache – Hosted Cache Mode File Server Tutorial

Hi everyone. Today I will show you how you can use BranchCache in Hosted Cache Mode to reduce your WAN traffic and to improve your users experience.

You need the following things:

  • Hosted Cache Server: Windows Server 2012 Standard (Windows Server 2008R2 Enterprise will work too but an Enterprise license is much more expensive)
  • Content Server: Windows Server 2008R2 Standard
  • Clients: Windows 7 Enterprise or higher or Windows 8 Enterprise or higher
  • WAN Emulator: WANem (more information about WANem here)

Test Setup

The below picture shows how I set up my test machines:


Additionally I configured Static Routes for my FileServer and my Client machines. The Static Route of the FileServer forces it to send traffic always over the WANEM machine to the Client machines. The Static Route for the Client machines forces them to send traffic always over the WANEM machine to the FileServer.

This way you can emulate how file downloads will behave over WAN links.


This is what you need to do to make it work:

On the FileServer:

  • Run cmd as Administrator and run the following command:
route –p add <Client Machine IP> mask <WANEM IP>

Important: You need to add a Static Route for every Client machine.

On the Client Machines (on all clients):

  • Run cmd as Administrator and run the following command:
route –p add <FileServer IP> mask <WANEM IP>

On the WANEM machine:

  • All you need to do here is to make sure that packets will be forwarded.

Hosted Cache Server Setup

To setup your Hosted Cache Server you need to do the following:

Run PowerShell as Administrator and enter the following commands:

Install-WindowsFeature BranchCache -IncludeManagementTools
Enable-BCHostedServer -RegisterSCP

That´s all you need to do to make BranchCache work for your Windows 8 Clients.

For Windows 7 Clients there are some additional steps:

If you run cmd as Administrator and run the following command:

netsh branchcache show status all


You will receive a warning that you need a certificate to make BranchCache work for Windows 7 Clients. You can create a certificate for your Hosted Cache Server by following this instructions:

The first step is to install IIS on your Hosted Cache Server and click on Server Certificates.


Now click on Create Self-Signed Certificate…


Choose a friendly name like “BranchCache” and click on OK.


Run mmc as Administrator and add the Snapin Certificates. Choose Computer account and click Next.


Now choose Local computer and click on Finish.


Now open the Export Wizard.


Choose No, do not export the private key.


Next choose DER encoded binary X.509 (.CER).


Now double click your certificate and go to Details. Copy the Thumbprint value and remove all whitespaces.


Now run cmd as Administrator and run the following command:

netsh http add sslcert ipport= certhash=<Thumbprint value> APPID={d673f5ee-a714-454d-8de2-492e4c1bd8f8}


If your run cmd as Administrator again and run the following command again, you will no longer receive the warning mentioned above:

netsh branchcache show status all

That´s it. You have successfully configured your Hosted Cache Server for Windows 7 and Windows 8 Clients.

Content Server Setup

The first thing you need to do is to install the feature BranchCache for network files on your FileServer.


The next step is to create a GPO for your FileServer:


All you need to do is choose Allow hash publication for all shared folder.


The last step is to enable BranchCache on your Share:

Access your Shares Properties and go to Advanced. Now check Enable BranchCache and click on OK. Done.


That´s all you need to do to enable BranchCache on your FileServer.

Windows 8 Client Setup

To setup your Windows 8 Clients to use BranchCache you need to do the following:

Run PowerShell as Administrator and enter the following command:

Enable-BCHostedClient -ServerNames <Hosted Cache Server Name>

That´s it. Your Client is now ready.

Windows 7 Client Setup

To configure your Windows 7 Clients create a new GPO and enable the following BranchCache settings:

  • Turn on BranchCache
  • Set BranchCache Hosted Cache mode


Now enter the FQDN of your Hosted Cache Server.


The next step is to configure your Clients Windows Firewall. Enable the following Inbound Rules:

  • BranchCache Content Retrieval (HTTP-In)
  • BranchCache Peer Discovery (WSD-In)


Now import the Hosted Cache Servers certificate which you exported earlier.



Import your certificate to Trusted Root Certification Authorities.


Additional step:

You can set a network latency value. If your network latency exceeds this value your client will get the data from your Hosted Cache Server instead of the Content Server. If you set a value of 0ms your Hosted Cache Server will be contacted always. (The default network latency value is 80ms).

Important: Please keep in mind that your clients will also get their data directly from your Content Servers if your files are smaller than 64KB.


That´s it your client is now ready.


Access your WANEM machine via http://<WANEM IP>/WANem and setup a bandwidth limit and delay for your test.


Well, that´s it. You successfully configured BranchCache in Hosted Cache mode. Pretty simple, isn´t it?

I hope my post was interesting and useful for you.

You can read more about BranchCache in this document you can get from here.


Tagged , ,

Windows – Installation from Harddrive

Hello everyone. Today I found a method to install Windows directly from a hard drive.

To do so you need to do the following:

  • Get a hard drive you want to install into your machine (I chose a 64GB SSD)
  • Format it and choose NTFS as file system


After you prepared your hard drive you need to copy the following folders and files from your Setup Medium to your hard drive:

  • boot
  • sources
  • bootmgr


Now run cmd as Administrator and run the following commands to make your hard drive bootable:

list disk
select disk x
list partition
select partition x
X:\boot\bootsect.exe /nt60 X:

Replace x and X with the values of your hard drive.


That´s it. Your preparations are done. Now insert the hard drive into your machine and make sure to boot from hard drive.

Install Windows as you would do normally but do not format your hard drive, otherwise all setup files would get lost and the setup will not finish successfully.

After Windows has been installed successfully, run cmd as Administrator and run the following command:



This will open a window like the one in the screenshot above. Now choose the Boot tab and select Windows Setup (\windows) and delete it. This will remove the Windows Setup option from the Boot Manager window when you boot your machine.


The last step is to remove the setup files. To do so, delete the sources folder from the C partition of the machine.

That´s it. You successfully installed Windows without using any CDs/DVDs or USB Sticks or additional software. For more information have a look at the sources.