MCCI Blog

Subscribe to feed Viewing entries tagged Useful tips

Using Microsoft's VHD version of Windows Server 2015 R2

Posted by Terry Moore
Terry Moore
 
User is currently offline
on Sunday, 06 September 2015
in Useful Tips

Microsoft has a pre-installed VHD version of Windows Server 2012 R2 available for download. 

The reference can be found here: https://technet.microsoft.com/library/dn303418.aspx, under the section titled "Installing versions distributed as VHDs".  The VHD can be downloaded from here: http://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-2012-r2#evaluation_521.

I can confirm that the download evaluation image works well, and is much faster to set up than installing from distribution ISOs. But I could not make their instructions work for me, and a quick search of the web indicated that others were puzzled.

Here are the original instructions:

To use the VHD distribution, you must have a computer running Windows Server 2008 R2, Windows Server 2012, or Windows Server 2012 R2. The Hyper-V server role must be installed.

To install the VHD

  1. Download the VHD file.
  2. Start Hyper-V Manager. On the Action menu, select Import Virtual Machine.
  3. Navigate to the directory that the virtual machine file was extracted to and select the directory (not the directory where the VHD file is located).
  4. Select the Copy the virtual machine option.
  5. Confirm that the import was successful by checking Hyper-V Manager.
  6. Configure the network adapter for the resulting virtual machine: right-click the virtual machine and select Settings. In the left pane, click Network Adapter. In the menu that appears, select one of the network adapters of the virtualization server, and then click OK.
  7. Start the virtual machine.

These instructions don't quite work. 

First of all, the VHD is not a VM, so you can't copy or import it.

Second, it's not clear (from web searches) that this will work at all under Server 2008 R2 -- there were hotfixes suggested.

Luckily, I have Windows 10 Pro, and this works fine as a host. (In fact, it appears that Windows 8.1 Enterprise also works; I used that for some of the screenshots. But I did most of this on Windows 10, and that's what I'd recommend to others.)

Here's the procedure I followed.

To prepare the Windows 10 Pro system

  1. Make sure you have Windows 10 Pro installed. Press [Windows}R and type "winver", then press enter. In the resulting text box, confirm that you see the text, "The Windows 10 Pro operating system and its user interface are protected..." If you see Windows 10 Home, you'll need to upgrade.
  2. Right click on Start, and select "Programs and Features"
  3. Select "Turn Windows features on or off" (on left)
  4. Scroll down to Hyper-V, and make sure the top level checkbox and subordinate checkboxes are all ticked. If not, check them, and go through the installation process. A reboot will be needed at this point.
  5. Once you've confirmed that Hyper-V is installed, press [Windows]R and type "mmc", then press enter. You'll probably get a UAC pop-up ("do you want to allow this app to make changes to your PC?"); if you do, click [Yes].
  6. Select File>Add/Remove Snap-In...
  7. Scroll down to Hyper-V Manager, click "Add". There typically will be a pregnant pause, followed by a progress bar; then Hyper-V Manager will appear under "Selected snap-ins" on the right. Click OK.  (The process of doing this creates an applet; from this point on, you can click start and type "Hyper" and "Hyper-V Manager" will show up.
  8. You'll now see Hyper-V Manager under Console Root:

  9. Click on "Hyper-V Manager" in the left pane, expand things if necessary, and you'll see something like the following:

  10. You probably want to configure one or more networks for use by Hyper-V. To do this, make sure your machine is selected in the left panel, then on the Action menu select Virtual Switch Manager... I created an External switch, Connection type  "External network", and selected my Ethernet adapter in the drop-down list. (I've also successfully selected a Wi-Fi adapter at this step.) Very important: be sure to select "[x] Allow management operating system to share this network adapter".  Click OK.
  11. You're now ready to proceed.

To install the VHD

  1. Download the VHD file. 
  2. If needed, copy the VHD file to a suitable location. On my system, Hyper-V looks for VHD files in C:\Users\Public\Documents\Hyper-V\Virtual hard disks, so I put it there.
  3. Start Hyper-V Manager, and make sure your machine is selected in the left panel. On the Action menu, select New... > Virtual Machine.
  4. Go through the steps of creating a new virtual machine. On the following menu, make sure you select "Generation 1 Virtual Machine". Click Next.

  5. "Assign Memory": Specify 2GB of RAM. I didn't select "[ ] Use Dynamic Memory for this virtual machine". Click Next.
  6. "Configure Networking": you can do this later -- just click Next
  7. "Connect Virtual Hard Disk" -- I selected "Attach a virtual hard disk later". Click Next.

  8. "Completing the New Virtual Machine Wizard" -- review the options, and click "Finish" to create the VM.
  9. Verify that the VM was successfully created by checking Hyper-V Manager
  10. Configure the downloaded VHD file as the disk for the resulting virtual machine: right-click the virtual machine and select Settings. In the left pane, click IDE Controller 0. In the right pane, select "Hard Drive", then Add. In the menu that appears, under Virtual Hard Disk, select Browse..., and navigate to the VHD image you downloaded. Select the file and click OK.
  11. Configure the network adapter for the resulting virtual machine: right-click the virtual machine and select Settings. In the left pane, click Network Adapter. In the menu that appears, select one of the network adapters of the virtualization server, and then click OK.
  12. Start the virtual machine.

Was this post useful to you? Want to see more on some topic? Leave a comment, or find me on Twitter (@TmmMcci) or LinkedIn (http://www.linkedin.com/in/terrillmoore/en).

 

 

Hits: 2097 0 Comments
0 votes

Cygwin home directories

Posted by Terry Moore
Terry Moore
 
User is currently offline
on Saturday, 04 July 2015
in Useful Tips

I recently installed some new tools from a third party, and had to update my Cygwin installation.  There is no official version of the overall release (see the FAQ); but I was running a release from November 2014, or so, and I updated today (July 4).

After the update, my Cygwin home directory had changed, and wasn't what I wanted.

Summary: if your Cygwin home directory is wrong after an update, you need to look at /etc/nsswitch.conf, not /etc/passwd.

Here are the details.

After I updated, my home directory was a different place than before. I recognized this immediately because the prompt changed from

bash:redacted::~ $

to

terry@redacted ~
$

And of course, all the other settings from my .bashrc were not taking effect.

In my setup, for historical reasons, my home directory is "c:\usr\terry" -- I've been running this setup since Windows NT days, and it's been nice not having a name that changed based on the Windows version in use. I use the same home directory for Cygwin and Windows.

Also for historical reasons, I have let Windows continue to assign whatever it felt like for a home directory. On my current Win8.1 machine, that's "c:\users\terry".

In the old version of Cygwin, this was accomplished by editing the /etc/passwd file (as on Unix). My passwd file contains the following line:

terry:unused:1000:513:U-REDACTEDterry,S-REDACTED-1000:/cygdrive/c/usr/terry:/bin/bash

In previous versions of Cygwin, this was all that was needed; when I launched a Cygwin window, bash found my .bashrc file in c:usrterry, and things proceeded as I expected.

After I updated to the version including Cygwin 2.0.4, this no longer worked. Cygwin was not honoring the contents of /etc/passwd.

I'll omit a discussion of the things I tried. It turns out that, by default, the newer versions of Cygwin no longer use /etc/passwd.  Instead, there's a new mechanism, /etc/nsswitch.conf, based on a similar mechanism from Linux. This page has all the details.  Search for nsswitch.conf, and don't worry too much about all the AD and SAM stuff; I was able to ignore it.

In order to get my home directory setup working again, I added the following to /etc/nsswitch.conf:

db_home: /cygdrive/c/usr/%U

%U is expanded to the current user's Windows login name (terry in my case).

The following setting is similar and useful, but it don't do what I want.

db_home: windows

It doesn't do what I want, because it uses the Windows home directory, which is c:\users\terry. This causes my home directory to be /cygdrive/c/Users/terry, which isn't the place I want. (Something like this might be good for other people, however, which is why I mention it.)

(Updated 2015-09-06: add some missing backslashes, make one-page article.)

Was this post useful to you? Want to see more on some topic? Leave a comment, or find me on Twitter (@TmmMcci) or LinkedIn (http://www.linkedin.com/in/terrillmoore/en).

Hits: 2319 0 Comments
0 votes

Decoding Arbitrary USB Protocols Captured with Total Phase Beagle

Posted by Terry Moore
Terry Moore
 
User is currently offline
on Monday, 16 June 2014
in Useful Tips

One of the most useful tools for USB development is a protocol analyzer, such as the Total Phase Beagle 480. These tools not only capture data, but include class protocol decoders that interpret the trace at a higher level of abstraction.

Sometimes, however, the analyzer software doesn't have the ability to decode the protocol of your device. MCCI often has to capture USB data for new protocols, or for vendor-specific protocols. In this case, the analyzer software doesn't have the appropriate class decoder. In this case, we typically write tools to parse the output from the analyzer and display the data in terms of the target protocol.

MCCI's Yogender Saroha recently wrote a case study of how to do this for Remote NDIS and the Beagle 480, which Total Phase has published on their website, and sent out with their June newsletter. You can access the case study here. The case study includes a link to the complete source code distribution. The tool that Yogi built integrates nicely with the scripting facilities of the Total Phase Data Studio, and works on Windows, OS X, and Linux. You can readily modify the code to parse other protocols (and you'll get an idea of how MCCI does things).

If you find the tool useful, please let us know!

Tags: Useful tips
Hits: 1280 0 Comments
0 votes

Seeing recent mail in Thunderbird

Posted by Terry Moore
Terry Moore
 
User is currently offline
on Thursday, 04 July 2013
in Useful Tips

Thanks go to Balaji Sivan (profile here) who followed up my recent post Outlook tip: Getting just the messages received in the last 2 days with a comment showing how to do something similar in Thunderbird.

I think his comment deserves its own post, so without further ado...

Hits: 1352 3 Comments

Outlook tip: Getting just the messages received in the last 2 days

Posted by Terry Moore
Terry Moore
 
User is currently offline
on Wednesday, 03 July 2013
in Useful Tips

In this post, I describe how to use Microsoft Outlook search folders to show you all and only the messages received in the last two days.

MCCI runs by email.  Even for our web apps like Jira and Crucible, most of us get our information via email. It's simple, it's efficient, and there's only one place to look.

This is great in theory, and works well with mailers like Eudora, but it's not a workflow that Outlook accommodates directly. With Eudora, you could bring everything into your inbox, read the message, then apply filters to move the message to the right folder. That's not convenient with Outlook. Instead, you set up filters so that incoming mail gets delivered to the right folder immediately upon arriving at your system.

Outlook's pre-filtering works pretty well, unless you have a lot of folders. Then it becomes difficult to keep track of the "recent" mail. You can do a quick search for unread messages, but then as soon as you open a message, it drops off the list. That irks me when I'm reading messages to get a picture of what's going on (what my friends with military experience call "building situational awareness"). I like to scan messages quickly, going to the next message unless something demands immediate attention. Sometimes, it's not until after I've moved on that I realize that I need to act on a message two or three back in the list.  Unfortunately, with an "unread message" quick search, you can't back up -- you've read  the older message, so it's no longer in the unread-message search list. Since mail is pre-filtered and dropped into folders, I'm often not sure where to look. After a few painful searches trying to find a message that was filed in a different place than I expected, I stopped using this technique.

The simple approach, and the one I used until I found this approach, is to simply scan over your folders in the pane on the left (the Navigation pane). The ones with unread messages will be in bold. However this is tedious and error prone if you have a lot of folders; and if the folder contains subfolders, the parent folder doesn't get bolded, only the subfolder with the unread message. If the parent folder is closed, you don't see that there's a message waiting at all.

The right approach is to have all the messages for the last day or two show up in a search folder. At midnight every day, the messages from the day before yesterday fall out of the folder. Even with lots of mail and lots of folders, I've found I can cut my mail scan time substantially.

Setting up a "Recent Mail" search folder takes multiple steps, but it's well worth the effort. I showed this to one of my colleagues, who showed it to another; it seems to be useful no matter your work style. It's useful enough (and popular enough within MCCI) that I thought I'd share instructions on how to set it up. Keep reading to get the gory details.

(If you're looking for equivalent instructions for Thunderbird, check this post: Seeing recent mail in Thunderbird.)

Hits: 10525 2 Comments
0 votes
Legal and Copyright Information