Tag Archives: vmware

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.

    Connect to a removable drive in a Hyper V Virtual Machine (Windows User Series)

    Introduction

    This post is based on using Windows 10 on the host and Windows Server 2012 R2 on the guest (Virtual Machine), but on Windows 7, 8 and 8.1 things work similarly.

    People coming from a VMWare environment might wonder what this is all about. What is the point, right?

    I must admit, sharing or mapping a drive in a Hyper V virtual machine (a.k.a. “guest”) is not such a nobrainer as in VMWare. But no worries, with a little bit of effort it can be done easily.

    So, what is the problem?

    Well, I mount a VeraCrypt container on my host machine, and want to see the drive in my guest machine.  Or plug in a USB pen drive or removable harddisk, and use it on the guest machine.

    Common ways to connect to a (removable) drive

    I did it my way

    I was looking for a more convenient way, that is, one I have to set up only once, and does not depend on the RDP protocol.

    In my opinion a networkshare was the way to go.

    But there were a few challenges:

    1. Windows tends to “forget” a shared drive or folder once this drive has been gone (usb media removed or VeraCrypt container unmounted). This is a problem, because then you have to configure the removable drive for sharing every time it is mounted.
    2. I did not want to do a round trip to my router, I want it to be a host/guest only party.

    But I managed to get it working, and in the next paragraph I will tell you how.

    myway3

    Steps to do it “my way”

    Again (see my previous post), the magic word to get this working is .. a junction!

    Alright, having said that, where do we start?

    We need set up a few things;

    1. An internal network connection between guest and host OS.
    2. A junction pointing to a removable drive letter on the host.
    3. Share that junction to one or more Windows users on the host.
    4. Create a mapped network drive on the guest.

    Important note : if you want to map more than one drive on the host, you have to edit the hosts file on the virtual machine. After Step 4 below, I will explain how to do this.

    Are you ready? Let’s roll up our sleeves and get going!

    Step 1 – Set up an internal network connection between guest and host OS

    1a – Create a Virtual Network Switch

    Start Hyper V Manager, and select Virtual Switch Manager from the Actions pane.

    WinS01E02_Step1a1

    Create a new virtual network switch of type Internal.

    WinS01E02_Step1a2

    Give the Virtual Switch a name (I couldn’t think of a better name than “Internal”), leave other options as they are by default and press OK.

    WinS01E02_Step1a3

    1b – Add a network adapter to the virtual machine and configure it to use the Internal Switch

    Now, open the Settings for the virtual machine.

    WinS01E02_Step1b1

    Choose Add HardwareNetwork AdapterWinS01E02_Step1b2

    Configure the network adapter to use the Virtual switch Internal (or any other name you gave it). Press OK.

    WinS01E02_Step1b3

    1c – Find the Internal IP Address of the host

    Still on the host, start a command prompt and type ipconfig. 

    Then search for an Ethernet Adapter vEthernet (Internal) and write down the Autoconfiguration IPv4 Address. You will need it in a few minutes.

    WinS01E02_Step1c1

     

    Step 2 – Create a junction pointing to a removable drive letter on the host

    Insert your USB storage media or mount a VeraCrypt File container.

    For the example I use drive P on the host. Please replace P everywhere with the driveletter of your removable media.

    Now find a folder on a fixed drive, e.g. where you store your Hyper V Virtual Machines. In the example I will use E:\HYPER_V\SHARES

    Start a command prompt and type

    mklink /j “E:\HYPER_V\SHARES\P” “P:\”

     

    Replace the foldername and the drive letter with your values.
    The output of the command window should confirm that the junction was made:
    WinS01E02_Step2a

    People who have read my previous post in my Windows User Series might remember that I preached that it is not recommended to make junctions pointing to removable drives. Well, this post proves that there is at least one exception to this rule of thumb!

    Step 3 – Share that junction to one or more Windows users on the host.

    Open the Properties of the junction E:\HYPER_V\SHARES\P and select tab Sharing. Press Advanced Sharing.

    WinS01E02_Step3a

     

     

    Select Share this folder and press Permissions.

    WinS01E02_Step3b

    Remove Everyone from Share Permissions and add at least one user from the host. Give this user the appropriate permissions.

    Tip: if possible, use a (special) account from the host of which the password never changes, for reasons I will tell below.

    WinS01E02_Step3c

     

    Step 4 – Create a mapped network drive on the guest

    Now, in Hyper V Manager, start the Virtual machine.

    Once the Virtual machine is started, log in, start a Windows Explorer and choose Map Network Drive from the menu.

    Choose a Drive (can be the same letter as on the host, but this is not necessary).

    For Folder, type \\<Host Internal IP Address>\<Share Name>

    (or \\<Host name from hosts file>\<Share Name> if you have modified the hosts file)

    Check Reconnect at sign-in (if you think this is convenient).

    If you do not want a permanently mapped drive, you could create a cmd file with a net use command, and execute it when you need to map the drive. 

    Check Connect using different credentials.

    WinS01E02_Step4a

    In the Windows Security screen, enter a username of the host that has permissions on the share you created earlier.

    Note: to indicate that you use a username of the host machine, type the host computer name and a backslash in front of the user name .

    If you check Remember my credentials, the credentials are stored in the Windows Credential Manager of the guest (Virtual Machine), so you don’t have to provide them every time you access the mapped drive. But don’t forget, that when you change the password from the account on the host, you have to change the saved password also in the Credential Manager of the guest (accessible through Control Panel). When you are using names from the hosts file instead of the IP address, the same credentials will even occur multiple times, e.g. for “host1”, “host2”, etc! Therefore, it is best to use a (special) account from the host of which the password never changes.

    WinS01E02_Step4b

    That’s it!

    WinS01E02_Step4c

    Remember, as soon as you plug in the removable drive on the host, it will be available immediately in the Virtual Machine.

    If you get this message, you know that the removable drive is not available on the host (yet). You have to plug it in first.

    WinS01E02_Step4d

    Appendix – Only needed if you want to map more than one drive: edit the hosts file.

    Following steps 1 to 4 you can map only one drive, because if you try to connect a second drive, your will get a “Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed… ” error as shown below.

    WinS01E02_Limitations

    To map multiple drives, you have to do a little trick so that your guest thinks you are connecting to different computers ..

    Start Windows explorer on the guest

    Go to your virtual machine, start Windows Explorer, and go to the folder C:\Windows\System32\drivers\etc.

     Copy and adjust the hosts file

    Copy the file “hosts” (it does not have a file name extension) to a different temporary folder, e.g. your desktop folder.

    Open the file with a text editor, e.g. Notepad and add the Internal IPv4 adress of the host, followed by a space and then a name. The trick really is to add multiple lines with the same IP adress but a different name. I just keep it simple by numbering the names but you can do whatever you want, as long as the names are different.

    169.254.151.11 host1
    169.254.151.11 host2

    Finally your hosts file should look similar to the one below (I have added a few more so my hosts file is “future proof”):

    WinS01E02_Step5b

    Save and close the file and copy it back to the original folder C:\Windows\System32\drivers\etc. Confirm to replace the existing file.

    Now walk trough Steps 2 to 4 for each network drive you want to map. Instead of using the IP address, use a name from the hosts file, for each mapped drive a different name, and you will not get the “Multiple connections” error.

    Here you will see an example of the endresult: I mapped drives H, P and Z using names host1, host2 and host3.

    WinS01E02_Step53

    Conclusion / wrap up

    In this blog post, I have explained how to map a removable drive on the host operating system as a network drive in a Hyper V Virtual Machine.

    By using a junction on a fixed drive on the host, a Windows problem forgetting that a removable drive was shared, can be circumvented.

    By using an Internal network connection, there is no router round trip, nor a dependency to use a remote desktop connection to start up the guest. Also multiple virtual machines could have access to the same drive at the same time.

    Finally by changing the hosts file, you can connect to multiple (removable) drives on the host computer.

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