bookmark_borderHow to Clone Your Windows 10 Installation USB Drive to Another USB Drive

I recently purchased and installed the retail version of Windows Pro on my primary desktop machine. The installation media came on a USB flash drive. I like to keep backup copies of the Windows installation media, preferable at on offsite location in case I need to reinstall the operating system and the original media is unavailable for some reason. This post described how to clone this USB flash drive. Software versions used in this post were as follows:

  • Windows 10 Pro (x64)
  • ImageUSB, version 1.3.1004

So let’s get started…

To clone the Windows 10 installation media we’re going to use ImageUSB. ImageUSB is a free utility from PassMark software which lets you create on image file from a USB flash drive and then write that image to one or more USB flash drives.

Begin by downloading ImageUSB, then unzip and copy the files to a location of your choice. Insert the Windows 10 USB flash drive into an available USB port then double-click on the file imageUSB.exe. Select the Windows 10 USB flash drive that appears under “step 1”, then select the option to “Create the image from USB drive” under “step 2”. Under the “Available Options” section ensure that the “Post Image Verification” option is selected so that ImageUSB can verify the integrity of the image after it writes it. ImageUSB needs a location and file name to write to; select both under “step 3”. In this example, we’ll write the image to C:/Users/iceflatline/Desktop/win10-image.bin. Now select “Write” under “step 4” and ImageUSB will write the image file (See Figure 1).

Screenshot showing how to create an image of a USB drive in ImageUSB

Figure 1

Once ImageUSB completes writing your image remove the Windows 10 USB flash drive and insert the USB flash drive you want to write win10-image.bin to into an available USB port. Note that this drive must be formatted with suitable file system (e.g., exFAT or NTFS) and have sufficient space available to contain the Windows 10 image (~16 GB). This space will be inaccessible on the USB flash drive after the writing process; however, any remaining space will be accessible.

Select “Refresh Drives” in ImageUSB, and select the USB flash drive under “step 1”, then select the option to “Write the image to USB drive” under “step 2”. Again, ensure that “Post Image Verification” is enabled. Select “Browse” in “step 3” and navigate to C:/Users/iceflatline/Desktop/win10-image.bin. Now select “Write” under “step 4” and ImageUSB will write the win10-image.bin to the USB flash drive (See Figure 2).

Screenshot showing how to write an image to a USB drive in ImageUSB

Figure2

Verify that your computer can boot to the backup copy of the Windows 10 installation media and then store the USB flash drive in safe location. Note that ImageUSB can only write *.bin files created with ImageUSB.

Conclusion
ImageUSB is great tool for creating exact bit-level copies of USB flash drives, including those containing Windows 10 installation media.

bookmark_borderHow to Install and Configure a TeamSpeak Server With a Different Voice Port

(20200803) – The steps described in this post were amended to address changes in recent versions of software — iceflatline)

TeamSpeak is a voice communication tool for online gaming, education and training, internal business communication, and similar use cases. This post will describe how to install TeamSpeak server on the Windows operating system, configure it to listen for incoming voice connections using a non-default UDP port, and test the installation/configuration using the TeamSpeak client application. Also discussed is how to remove your TeamSpeak server from the list of publicly available servers. The versions for the software discussed in this post are as follows:

  • Windows 10 Pro x64
  • TeamSpeak Server 64-bit 3.12.1
  • teamSpeak Client 64-bit 3.5.3

Let’s get started…

Install and Configure the TeamSpeak Server

Start by downloading the TeamSpeak server and extracting the folder contained within the zip file to a location of your choice. We’ll use C:\ in our example. After the folder is extracted we should see the folder C:\teamspeak3-server_win64.

Open this folder and create a shortcut to C:\teamspeak3-server_win64\ts3server.exe to somewhere convenient. Right-click on the shortcut, navigate to Properties, and append createinifile=1 to C:\teamspeak3-server_win64\ts3server.exe in the Target field (e.g. C:\teamspeak3-server_win64\ts3server.exe createinifile=1) then select “OK” to save and close the window.

Double-click on this shortcut to start to start the TeamSpeak server, and accept the license agreement. You should now see a new icon in the notification area of the windows task bar indicating that the TeamSpeak server has started. When the TeamSpeak server is started for the first time a pop-up window will appear showing the Server Query credentials and the Server Admin Token (See Figure 1). You can disregard this information for now and close the window.

Screenshot showing the Server Query credentials and Server Admin Token after initial TeamSpeak server startup

Figure 1

Now open the folder C:\teamspeak3-server_win64 and you should see several new files, including ts3server.ini and ts3server.sqlitedb.

Stop the TeamSpeak server by right-clicking on the icon in the notification tray and selecting “Exit”. Delete the file C:\teamspeak3-server_win64\ts3server.sqlitedb. Open C:\teamspeak-3-server\ts3server.ini and change the value of default_voice_port value to the port number desired. We’ll use 12010 in our example.

Once again right-click on the shortcut, navigate to Properties. Replace createinifile=1 with inifile=ts3server.ini in the Target field (e.g., C:\teamspeak3-server_win64\ts3server.exe inifile=ts3server.ini) then select “OK” to save and close the window.

Restart the Teamspeak server using the shortcut and a new C:\teamspeak3-server_win64\ts3server.sqlitedb file will be created containing the new port number. The pop-up window showing the Server Query credentials and the Server Admin Token will again appear. This time you’ll want to copy at least the Server Admin Token somewhere as this key is needed to gain administration rights to your TeamSpeak server. I also recommend copying the Server Query credentials somewhere as well. This will be needed should you ever want to use ServerQuery, a command line based administration tool supported by TeamSpeak.

Test Using the TeamSpeak Client

Okay, now that we have the TeamSpeak server installed and configured let’s install the TeamSpeak client and test to ensure that you can connect to it.

Download the TeamSpeak client application and install it. Start the TeamSpeak server and then start the TeamSpeak client. Once the TeamSpeak client has started select Connections->Connect (or use CTRL+s). In the Server Address field enter the host name of the Teamspeak server followed by the port number the server is listening on for incoming voice connections. These two entries should be seperated with a colon. Since our Teamspeak server is located on the same machine as the TeamSpeak client we’ll use the host name localhost. The port number will of course be the one we configured for this Teamspeak server, port 12010 (See Figure 2):

Screenshot showing a new TeamSpeak server address and UDP port being configured in the TeamSpeak client application

Figure 2

Select “Connect” and you’ll will be connected to your TeamSpeak server. A window will appear indicating that this is newly created Teamspeak server and that the administrative privileges have not yet been claimed. Enter your Server Admin Token, then select OK. Note that this pop-up window will occur each time you connect to the TeamSpeak server until you’ve used the Server Admin Token. An unused Server Admin Token can be entered at any time after you’ve connected to the TeamSpeak Server by selecting Permissions->Use Public Key.

Now that you’ve verified that you can connect to your TeamSpeak server locally, make sure to forward the correct UDP port (12010 in our example) in your NAT gateway so that, if desired, TeamSpeak clients outside of your local network can connect to your Teamspeak server.

Generating additional Server Admin Tokens

What if you want to add administrative privileges to another TeamSpeak client so, for example, you can administer the TeamSpeak server remotely? No problem. Using the TeamSpeak client you used previously to enter your Server Admin Token with connect to your Teamspeak server and navigate to Permissions->Privilege Keys and select “Create”. In the next window select Server Admin from among the options in the Group field. Enter a description if desired then select “Create” (See Figure 3). You can use this new Server Admin Token with another TeamSpeak client by connecting to the TeamSpeak server and selecting Permissions->Use Public Key.

Screenshot showing where to create a new Server Admin Token

Figure 3

You can revoke tokens at any time by navigating to Permissions->Privilege Keys, highlighting the desired token and selecting “Remove.”

Prevent your TeamSpeak server from appearing in the public server list

TeamSpeak servers are automatically added to a list of publicly available servers when installed. This may not be desirable. To remove your server from this public server list connect to your server using a TeamSpeak client with administrative privileges. Right-click on your server’s name and select Edit Virtual Server. Select the Misc tab and uncheck the option “Enable reporting to server list” then select “Apply” (See Figure 4).

Screenshot showing where to disable public server listing in the TeamSpeak server configuration

Figure 4

Conclusion

Well there you have it. A post describing how to install TeamSpeak server on the Windows operating system. The developers of TeamSpeak should make it easier for server administrators to make simple modifications like changing the default ports. Until they do this article should help you make those changes.

bookmark_borderRun a Windows Application as a Service with srvany

Occasionally the need arises for running an application in Windows as a service. This allows the application to run at boot time without the need for a user to be logged into the system in order for the application to start and operate. While built-in mechanisms such as Task Scheduler exist to help facilitate this, the ability to run an application as a service has certain advantages, notably the ability to prescribe certain actions be taken should the service fail. Take for example the the case where an application is listening for incoming IP connections. Being able to automatically restart the service without user intervention is desirable in order to avoid loss of service.

This post will describe how to use the Microsoft utilities instrsrv.exe and srvany.exe to install a Windows application as a service. instrsrv.exe is used to install the service while srvany.exe acts as a wrapper around the application and handles the service events. Both utilities are available as part of Microsoft’s Windows Server 2003 Resource Kit Tools. I have successful tested instrsrv.exe and srvany.exe on Windows 7/8.1; I have not tested them on Windows 10.

Let’s get started…

For purposes of example, we’ll assume we have a Windows application called “foobar” that is normally started by using the binary c:\foo\foobar.exe.

Start by downloading Microsoft’s Windows Server 2003 Resource Kit Tools and install it to a folder of your choice. Create a folder to contain the files instrsrv.exe and srvany.exe. We’ll use c:\srvany for our example. Now copy both files from the where you installed the Resource Kit tools to c:\srvany. After the files have been copied the Windows Server 2003 Resource Kit Tools may be uninstalled.

Now open a command prompt and install foobar as a system service using the following command. You may use any name you’d like for the service:

You should receive a response indicating that the service was successfully added.

Next, open the Windows registry editor and navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\foobar. Use the mouse or keyboard to highlight foobar and select Edit->New->Key to create a new key named Parameters. Highlight Paramters and select Edit->New->String Value to create a new string value named Application. Double-click on Application and enter the full path to foobar.exe (e.g., c:\foo\foobar.exe). That’s it. You can now close the registry editor.

By default, the newly created service foobar is configured to run automatically when the system is restarted. To change this setting to Manual, run the Services applet by entering services.msc from a command prompt or by using WIN+R. Locate foobar from among the list of services, right-click on it and select Properties and change its Startup type to Manual. A service set to Manual can be started from within the Services applet, or by entering the following from a command prompt:

Selecting the Recovery tab from within properties will allow you to chose what the system should do in the event if the service fails.

You can delete the service by entering the following from a command prompt:

There you have it. A nice simple way to register and run a non-service application as a windows service.

bookmark_borderConfigure Window 7 Folder Privileges

Unlike Windows XP, Windows 7 doesn’t automatically grant full access to directories and files if you log in as a system administrator. To gain control of a drive or directory and its contents you can perform the following steps:

  • Right-click on a drive or directory and select “Properties.”
  • Select the Security tab and then select the “Advanced” button.
  • Select the Owner tab and then select “Edit.” Click to highlight the user you want to assign ownership to. Make sure to check the check box “Replace owner on subcontainers and objects,” then select “Apply.”
  • Navigate back to the Security tab, click to highlight the same user and select “Edit.” Click to highlight the same user and assign the appropriate level of permissions using the check boxes (e.g., Full Control), then select “OK.”
  • bookmark_borderHow to Dual Boot Windows 7 and Linux using BCDEdit

    (20141224 – This post has been amended to address changes in recent versions of Ubuntu, and to remove outdated instructions — iceflatline)

    This post will describe how to use the Window 7 boot configuration data editor (BCDEdit) to configure a Windows 7 system that can boot to Windows 7 or a Linux distribution. The steps described in this post assume that Windows 7 and the Linux distribution will occupy the same physical hard drive. Configuring BCDEdit to recognize and boot a Linux distribution located on a second physical hard drive is beyond the scope of this post.

    To help explain the steps involved, we’ll use an 320 GB SATA hard drive with Windows 7 already installed. We’ll reduce the size of the partition containing the Windows 7 operating system and re-partition the remaining unallocated disk space in order to install the Linux distribution Ubuntu. We’ll then use BCDedit to add a Windows boot menu option for Ubuntu. All steps involved assume you have a functioning CD drive (or USB drive if you’d prefer) that the system can boot from. The software versions used in this post were as follows:

    • Ubuntu v14.10 (x64)
    • Windows 7 Professional (x64)

    Oh…, and while I’ve never encountered a situation where the Windows 7 Disk Management tool destroyed existing disk data, make sure you backup any critical files before you proceed.

    So, let’s get started.

    Reducing the Windows Partition

    The first thing that we need to do is reduce the size of the existing Windows 7 partition. While you can use third-party applications like GParted, I found Windows 7’s own Disk Management tool to be the most efficient method for accomplishing this task. The Disk Management tool can be accessed by using Win+r and entering the command diskmgmt.msc.

    You’ll notice that Windows 7 currently occupies all of the existing disk space using two primary partitions: one small boot partition; the other for the operating system. When finished, we’ll have five partitions in total: the two Windows 7-related partitions just mentioned, and ones for the Ubuntu operating system and Linux swap. We’ll also create a small FAT32 partition for sharing data between Windows 7 and Ubuntu. You’ll need to determine how much space you want to allocate to each of these additional partitions based on your requirements and disk size. For our 320 GB disk example, we’ll use the following partition layout:

    Windows 7: ~100MB (Windows 7 boot loader)
    Windows 7: ~251 GB
    Ubuntu: ~31 GB
    Linux-Swap: ~1 GB
    FAT32: ~16 GB

    Right-click on the Windows 7 volume (C:) and selected “Shrink Volume.” Then enter the amount of space (in Megabytes) that the partition should shrink (which in turn becomes the amount of space available to install our Linux distribution), which in our example is 48000 Megabytes (48 Gigabytes), then select “Shrink” (See Figure 1). When complete, exit out of the Disk Management tool and reboot the system.

    Screenshot showing the Windows 7 partition reduced ~48 GB using the Windows Disk Management tool

    Figure 1

    Installing Ubuntu

    Now it’s time to partition our 48 GB of unallocatd disk space and install Ubuntu. Download a copy of Ubuntu Desktop and burn it to a CD (or place it on a bootable USB drive). Boot the system using the Ubuntu disk. Select “Try Ubuntu…” and then double-click the “Install Ubuntu…” icon when the desktop appears. Continue through the installation process until you arrive at “Installation type” and select “Something else”, then select “Continue”. (See Figure 2).

    Screenshot of the Ubuntu installation type screen

    Figure 2

    The screen that follows is where we’ll instruct Ubuntu how to partition the unallocated disk space. Left-click on “free space” to highlight it and then select the “+” icon to create a new partition. Make the size of this partition 31000 MB. Ensure it’s a primary partition, and located at the beginning of the free space. Select the Ext4 journaling file system and, since this partition will serve as the root partition for Ubuntu, set the mount point to / from the list of choices in the drop-down lists. Now select “OK” to accept the changes (See Figure 3).

    Screenshot showing the creation of the Ubuntu root partition

    Figure 3

    Now let’s create a partition for use as Linux swap space. Once again, left-click on free space to highlight it and then select the + icon to create a new partition. Make the size of this partition 1000 MB. Our disk is limited to a maximum of four primary partitions, so we’ll make this a logical partition – again located at the beginning of the free space. Select “swap area” from the list of choices in the drop-down list, then select “OK” to accept the changes (See Figure 4).

    Screenshot showing the creation of the swap partition

    Figure 4

    Using similar steps, let’s partition the remaining free space as a FAT32 file system. This too should be a logical parition, located at the beginning of the space. You may also wish to set the mount point to /media/share, or something similar. The benefit of selecting a mount point at this stage is that Ubuntu will add this partition to the file /etc/fstab so that the system automatically mounts it at boot time. No worries though, you can always select a different mount point and manually mount it and/or add it to /etc/fstab at a later time. When complete, select “OK” to accept the changes (See Figure 5).

    Screenshot showing the creation of a FAT32 partition

    Figure 5

    The final step is critical. We need to tell the Ubuntu installer where to install the system bootloader (GRUB 2). We DO NOT want to install the bootloader on /dev/sda, as that would overwrite our disk’s master boot record, nor do we want to install it on /dev/sda1 or /dev/sda2, as that would overwrite the Windows 7 bootmanager files and boot configuration data, or the operating system itself. Instead, let’s have Ubuntu install its bootloader on the partition that will contain the Ubuntu operating system – in our case /dev/sda3. To do this, click on the drop down list under “Device for boot loader installation” and select /dev/sda3 (See Figure 6).

    Screenshot showing the correct partition for the ubuntu bootloader installation

    Figure 6

    Select “Install Now” and Ubuntu will begin the installation. When it completes you’ll be asked whether you’d like to reboot or “continue testing”. You should select continue testing as the following steps require access to a terminal.

    Configure Windows for Dual Boot

    Now that we have our disk partitioned and Ubuntu installed, let’s set up our system to boot Windows 7 or Ubuntu. This will involve copying the boot record of our Ubuntu partition to Windows 7, and using BCDEdit to create a new entry in the BCD store that will point to that file. This way Windows 7 will display a menu at boot time that will give you a choice between Windows 7 and Ubuntu.

    First, let’s make a mount point for the FAT32 partition we created. Open a terminal and enter the following:

    Next, let’s mount the correct device to this directory. Recall from the partitioning steps above that the FAT32 partition is located at device /dev/sda6:

    Write the first 512 bytes of our Ubuntu partition to a file and copy that file to our FAT32 partition:

    Note: using the FAT32 partition in the aforementioned steps is optional. You may chose to use another device such as a USB drive to copy the *.bin file to.

    Exit out of the Ubuntu live system and reboot to Windows 7. Along the way, you may see Windows perform a disk check (don’t worry, that’s normal, and should only occur once as a result of these procedures). Log into Windows 7 and open the FAT32 volume you created and you should see the ubuntu.bin file. Copy that file to the root of the Windows 7 volume (e.g., C:).

    Now we’ll use BCDEdit to add an entry to Windows 7’s BCD store. Administrative privileges are required to use BCDEdit, so use Win+r, type cmd, and then press CTRL+SHIFT+ENTER. Let’s start by creating an entry for our Linux distribution. Note here that you are free to choose another entry name if desired:

    BCDEdit will return an alphanumeric identifier for this entry that I will refer to as {ID} in the remaining steps. You’ll need to replace {ID} by the actual returned identifier. An example of {ID} is {d7294d4e-9837-11de-99ac-f3f3a79e3e93}. Next, let’s specify which partition hosts a copy of the linux.bin file:

    The path to our ubuntu.bin file:

    An entry to the displayed menu at boot time:

    and finally, let’s specify how long the menu choices will be displayed:

    That’s it! Now reboot and you will be presented with menu where you can choose to boot to Windows 7 or Ubuntu. When you choose Ubuntu, you’ll be taken to the it bootloader menu where you can choose to continue booting Ubuntu.

    On a final note, if at any time you want to eliminate the Ubuntu menu option simply delete the BCD store entry you created using the following command:

    Conclusion

    With a minimal amount time and a little Windows command line foo, you can easily set up a system that can dual boot Windows 7 and your choice of Linux distributions.

    References

    http://technet.microsoft.com/en-us/library/cc709667%28WS.10%29.aspx

    iceflatline