Tag Archives: windows

Free download: Blog Yearbook 2016

I have made a compilation of all my blog posts of the past year, and it was more work than you would think.
Especially because it also contains a non-published new article.

After filling in the form you can download the e-book for free.

I promise you the following:

  • I will not give or sell your email address to any third party.
  • I will not spam you.
  • If I start with a newsletter, you can easily unsubscribe or change the frequency.

(c) 2016 hansmichiels.com – Do not steal the contents – spread the link instead – thank you.

A naming convention for virtual machines and home networks (Windows User Series)

Introduction

If you are a professional working in the Information Technology Domain you might have set up virtual machines to test different software versions, do Proofs of Concept or just use them for the ease of backup and restore.
But what name do you give those virtual machines?
As long as it are only a few, it doesn’t really matter.

Challenge

It becomes a bit of a challenge when you are have different virtual machines all with a specific setup, e.g. different versions of the same software.
Recognizable?

Solution

I want to share my naming convention that I use for virtual machines and my home network.
It is pulled together from different sources in the internet, as well as my own insight, so don’t be surprised if you see parts of other standards.

My device names consist of the following parts:
1. Device type
2. Operating System Line
3. Operating System Version
4. Separator
5. Purpose of the device
6. Sequence number

A naming convention for virtual machines and home networks

1. Device type

Minimum and maximum length

Device type is a single character.

Domain values

Namepart Description
V Virtual Machine
S Physical Server
L Physical Laptop
D Physical Desktop
C Cloud Computer
P Printer
T Tablet Computer
M Mobile Phone

2. Operating System Line

Minimum and maximum length

Operating System Line consists of exactly two characters.

Domain values

Namepart Description
WS Windows Server
WC Windows Desktop/Client
LS Linux Server
LC Linux Client
OX OS X

3. Operating System Version

Minimum and maximum length

Operating System Line consists of 1 to 4 characters.

Domain values

For Windows devices use the internal version number:

Namepart Description
51 Windows Server 2003
52 Windows Server 2003 R2
60 Windows Server 2008
61 Windows Server 2008 R2
62 Windows Server 2012
63 Windows Server 2012 R2
100 Windows Server 2016
A “C” can be added to server versions, if the “Core” version is installed. E.g. 63C
51 Windows XP
52 Windows XP Professional x64
60 Windows Vista
61 Windows 7
62 Windows 8
63 Windows 8.1
100 Windows 10

Get other/older versions from wikipedia.

4. Separator

Minimum and maximum length

The separator is a single character: a hyphen (-).

Domain values

Must be a hyphen (-).

5. Purpose of the device

Minimum and maximum length

Purpose of the device consists of 1 to 4 characters.

Domain values

For Servers:

Namepart Description
DC Domain Controller
FS File Server
PS Print Server
WEB Web Server
ORA Oracle database
SQL SQL Server database
DB other database(s)
EXH Microsoft Exchange
SHP Microsoft Sharepoint
CTX Citrix Server
ESX VMware ESX Server
HV Windows Hyper-V Host

This part is optional for desktop devices.
If implemented, you could use:

Namepart Description
STD or S Standard
DEV or D Used for software development
GRD or G Used for graphical design

6. Sequence number

Minimum and maximum length

The sequence number consists of 1 to 6 characters.

WIN-S01E03-image3
Picture credits: © Yan Zommer | Dreamstime Stock Photos
Numbering your Windows instances.

Domain values

A sequence number making the name unique.
You can decide to make it unique based on purpose only, so you could have:
DWC61-STD001 and LWC61-STD002 (so you do not use 001 for the latter).
If you have a limited number of devices, you could put some intelligence in the number so you know which version of the ‘purpose delivering’ software is running.

Example names

Example name Explanation
DWS63C-HV01 Physical desktop running Windows Server 2012R2 Core, being a Hyper V Host with sequence number 01.
VWS63-SQL141 Hyper V Virtual machine running Windows Server 2012R2 with SQL Server, sequence number 141 (intelligent number, indicates that it is my first virtual machine with SQL Server 2014 installed, I would use 08x for SQL 2008, 09x for SQL 2008R2, 12x for SQL 2012, you get the idea). You could use this if the number of virtual machines per SQL version is less than 10.
VWC100-DEV151 Hyper V Virtual machine running Windows 10, used for development, with sequence number 151 (intelligent number, 15 indicates it’s my Visual Studio 2015 virtual machine, as I have only one of those, 151 is an excellent number).
LWC61-STD0554 Physical Laptop with Windows 7, with software for a ‘standard workspace’, sequence number 0554.

WIN-S01E03-image1
A real life example.

Warning/disclaimer

Do NOT use this naming convention for enterprise networks! Problems that could arise if you use it include:

  • A physical location is not part of this naming convention. In enterprise networks servers often have a physical location reference in their name.
  • The operating system is in the name. This if fine for your own lab virtual machines and home computers, but can be very inconvenient in company networks where the device name is in an inventory system. Enterprises typically do not want devices to be renamed when the Operating System is upgraded.

So.. use this naming convention only for the intended purpose, and take advantage of it.

Conclusion / Wrap up

I posted my own naming convention for virtual and physical computer devices I use “AS IS”.
I do not say it is perfect or useful in all cases.
Use the parts you think are convenient and adjust further to meet your requirements.
I would be thankful if you would like to share your adjustments with me, so I can update this post.
I discourage to use this standard in enterprise networks. For more details see the warning/disclaimer above.

(c) 2016 hansmichiels.com – Do not steal the contents – spread the link instead – thank you.

Windows drive full? Use junctions! (Windows User Series)

Introduction

Microsoft Windows is not so bad, is it? But in my experience it can be greedy as it comes to disk usage. Not that this is necessarily always Windows to blame, but also third party software or other reasons.

Whatever the reason is, if it happens you have a problem. But don’t panic, luckily there is something you can do about it!

Disk consumption in Windows is like a glass of water being filled until it would overflow ..
Disk consumption in Windows can be like a glass of water being filled until it would overflow ..

 

Use cases

But what situations are we talking about? I can give you some examples:

  • Windows updates eating disk space (does the folder “SoftwareDistribution” ring a bell?)
  • Visual Studio 2015 with full mobile development installation taking 40GB for that part only!
  • Software for navigation equipment that does need temporary space for downloading an update but has no way to choose the folder to download it to (my experience was with Garmin).
  • Just lots of huge files in “My music” or “My videos”, where basicly of course, there is no one to blame but you.
  • On a computer with a large amount of memory, having “hybernate” enabled. If you put a computer in “hybernate” all the memory contents is saved to disk, so when you have 16GB of RAM, you will need this amount of free disk space.
  • You have partitioned your disk to a “Windows” and a “Data” partition (aka a C- and a D-drive), but your underestimated the disk space required for the C-drive.
  • Your disk is not full but you want to store user data (documents, pictures, music and so on) on a different drive, e.g. so you can easily restore an image of Windows without copying your user data back after the restore.

 

Ways to free up disk space on drive C

The are more ways to free up disk space. However I want to focus on one solution, here is a (non-complete) list of things you could do:

  • Compress folders that you do not use frequently. This will save disk space but will cost cpu power when accessing the files in that folder(s).
  • If you have partitioned your disk, increase the size of the C-drive (and therewith decrease the size of the D-drive).
  • Using Windows utilities to free up disk space (can help but is not always you can regain enough diskspace with this)
  • Uninstall programs you do no longer need.
  • Use junctions. This is the solution I will dive into in this blog post.

 

Using junctions – prerequisites

There is one important requirement when it comes to junctions: you need to have more than one (fixed) disk or partition in your computer. If it is a second physical disk or a second partition on one disk does not matter. And of course you need to have free disk space on that second disk or partition.

So when you have a notebook with only a small sized SSD, and it is full, junctions can not do much for you.

WARNING! Don’t make junctions pointing to folders on removable drives, like USB pen drives, SD cards and so on for system-critical folders, otherwise applications might stop working or Windows would not even start!

Using junctions – how it works

Definition

First of all, what the heck is a junction?

I got to know junctions (also called a soft link) as a shortcut for a folder. This shortcut behaves like a folder but redirects all applications that access that folder to a different folder. Cool, hey?

If you want to know more: read more on MSDN

A junction in the Netherlands (Rotterdam)
A traffic junction in the Netherlands (Rotterdam)

Examples of use

An application taking up too much space

Okay, suppose you have Garmin software installed, you have only a few gigabytes free disk space and want to install a Garmin update on your device. Before starting to download and install the update, this is what you can do:

  1. Create a cmd script and store it on your computer (call it e.g. create_junctions_garmin.cmd)
  2. Paste this into the empty cmd file. Adjust the bold folder names if needed.

@echo off
echo — STEP 1 – CREATE TARGET FOLDER(S) —
pause
mkdir D:\Junctions
mkdir D:\Junctions\ProgramData
mkdir D:\Junctions\ProgramData\Garmin
echo Please check that the previous step was completed succesfully . . .
echo If errors occurred close the command window WITHOUT PRESSING ENTER ! ! !
pause
echo — STEP 2 – COPY FOLDER AND ALL SUBFOLDERS AND FILES —
pause
xcopyC:\ProgramData\Garmin” “D:\Junctions\ProgramData\Garmin” /E /K /X
echo Please check that the previous step was completed succesfully . . .
echo If errors occurred close the command window WITHOUT PRESSING ENTER ! ! !
pause
echo — STEP 3 – REMOVE SOURCE FOLDER —
pause
rmdir /s /q “C:\ProgramData\Garmin
echo Please check that the previous step was completed succesfully . . .
echo If errors occurred close the command window WITHOUT PRESSING ENTER ! ! !
pause
echo — STEP 4 – CREATE JUNCTION FOR SOURCE FOLDER —
pause
mklink /j “C:\ProgramData\Garmin” “D:\Junctions\ProgramData\Garmin
pause

3. Run the cmd file as Administrator and check that it runs without errors. Alternatively you could also move the folder including subfolders and files manually and create a cmd script that only contains STEP 4 – CREATE JUNCTION FOR SOURCE FOLDER

If files are locked, maybe you have to reboot and start Windows in Safe mode, then run the cmd script again.

Moving userdata to a different drive

However Windows offers to some extend the possibility to move these folders, in my experience still downloaded files, pictures or documents sometimes are stored on the C-drive. By creating junctions this is not the case.

I recommend to move this user folders manually and create only the junctions with a cmd script.

Warning / disclaimer: However this works fine for me on Windows 7 and 10 and I do not expect any problems if you follow the procedure, please try this at your own risk.

Note: this works also on non-English versions of Windows as the displayed localized folder names (e.g. in Dutch: “Documenten” for “Documents”) are not the actual folder names. So for the junctions you need to use the English names.

This is what you can do (adjust the bold folder names: replace Hans with your Windows username and replace D:\USERDATA with some other folder if you like)

  • Create a folder D:\USERDATA\Hans
  • Create a cmd script and store it on your computer (call it e.g. create_junctions_userdata.cmd)
  • Paste this into the empty cmd file

Note that you can select the folders of your choice, this list is just an example.

mklink /j “C:\Users\Hans\Downloads” “D:\USERDATA\Hans\Downloads”
mklink /j “C:\Users\Hans\Contacts” “D:\USERDATA\Hans\Contacts”
mklink /j “C:\Users\Hans\Favourites” “D:\USERDATA\Hans\Favourites”
mklink /j “C:\Users\Hans\Music” “D:\USERDATA\Hans\Music”
mklink /j “C:\Users\Hans\OneDrive” “D:\USERDATA\Hans\OneDrive”
mklink /j “C:\Users\Hans\Pictures” “D:\USERDATA\Hans\Pictures”
mklink /j “C:\Users\Hans\Videos” “D:\USERDATA\Hans\Videos”
mklink /j “C:\Users\Hans\Searches” “D:\USERDATA\Hans\Searches”
pause

  • Use Windows Explorer to go to the folder C:\Users\Hans
  • Select the following folders while pressing the CTRL key: Contacts, Documents, Downloads, Favourites, Music, OneDrive, Pictures, Searches, Videos.

Note that you can select the folders of your choice, but make sure every folder selected is in your cmd script.

  • Press CTRL+X (Cut)
  • Navigate to the folder D:\USERDATA\Hans
  • Press CTRL+V (Paste)
  • Run the cmd file as Administrator and check that the junctions are created.

User_junctions_cmd

For your interest, on the Windows drive the little arrow in the corner of the folder icon reveals that these “folders” are now actually junctions.

User_junctions

Conclusion / Wrap up

With junctions you can replace a Windows folder with a “shortcut” to a different folder.

This can amongst others be handy when you have lack of disk space on the Windows drive.

It is strongly recommended to create only junctions that redirect to folders on fixed drives.

I have explained some examples of how you can use junctions, but you can use junctions for other applications as well. Beware that in some cases files in folders you want to make a junction for can be locked. Stopping the Windows Services or applications accessing those files can help, or starting Windows in Safe Mode (I must admit I did not try this but in theory it should work).

(c) 2016 hansmichiels.com – Do not steal the contents – spread the link instead – thank you.