Quick IT tip: How to build bootable USB stick
Because of my main job and lack of human resources there, I invest less and less in community. Thus I lost my MVP title. Sorry, guys. Also a ton of management tasks in big company prevents me from actual coding. However I am still able to find some time for doing “real” things such as Windows Embedded Standard 2011 image building. Thus today I will explain how to build bootable flash USB disk with a couple of simple commands and without using special utilities.
Why to use bootable USB instead of regular CD or DVD ROM? Well, it is more convenience, takes less storage, faster and fully recycle. So let’s start.
1. Insert USB flash drive
2. Run command prompt shell as Administrator (just in case the keyboard shortcut for “Run as Administrator” is Ctrl+Alt+Shift)
3. Type “diskpart” to run Microsoft DiskPart utility.
C:\Windows\system32>diskpart
Microsoft DiskPart version 6.1.7600
Copyright (C) 1999-2008 Microsoft Corporation.
On computer: TAMIRK-DEV
4. List your disks by typing in “list disk” or for those who like it shorter (like me) “list dis”
DISKPART> lis dis
Disk ### Status Size Free Dyn Gpt
——– ————- ——- ——- — —
Disk 0 Online 149 GB 1024 KB
Disk 1 Online 75 GB 2 GB
Disk 2 Online 3814 MB 0 B
Disk 3 No Media 0 B 0 B
Disk 4 No Media 0 B 0 B
Disk 5 Online 14 GB 0 B
5. Identify your flash drive (in my case it is Disk 5)
6. Select this drive to mark it for work by using “select disk 5” or “sel dis 5” command
DISKPART> sel dis 5
Disk 5 is now the selected disk.
7. Clean it (this will delete everything on your disk drive, so be careful) by using “clean” or “cle” command.
DISKPART> cle
DiskPart succeeded in cleaning the disk.
8. Create primary partition – “create partition primary” or “cre par pri”
DISKPART> cre par pri
DiskPart succeeded in creating the specified partition.
9. Select new partition – “select partition 1” or “sel par 1”
DISKPART> sel par 1
Partition 1 is now the selected partition.
10. Mark it as Active partition – “active” or “act”
DISKPART> act
DiskPart marked the current partition as active.
11. Format – “format fs=ntfs quick” or “for fs=ntfs quick”
DISKPART> for fs=ntfs quick
100 percent completed
DiskPart successfully formatted the volume.
12. And finally my favorite command – “assign” or “ass” to mark it ready and create mount point
DISKPART> ass
DiskPart successfully assigned the drive letter or mount point.
13. Exit – “exit” or “exi” to return to command shell
DISKPART> exi
Leaving DiskPart…
Now your thumb drive is ready and bootable. So you can start copying files from ISO image into it.
Other option is to work with volumes rather than with disks. The all difference is in steps 4-6. Instead of “lis dis” use “lis vol” and instead of “sel dis” use “sel vol”. Maybe it is more convenience way of work because in this case you can identify partitions by labels and sizes rather than by sizes only.
DISKPART> lis vol
Volume ### Ltr Label Fs Type Size Status Info
———- — ———– —– ———- ——- ——— ——–
Volume 0 E DVD-ROM 0 B No Media
Volume 1 G DVD-ROM 0 B No Media
Volume 2 System Rese NTFS Partition 100 MB Healthy System
Volume 3 C NTFS Partition 68 GB Healthy Boot
Volume 4 D DATA NTFS Partition 80 GB Healthy
Volume 5 F READYBOOST FAT Removable 3812 MB Healthy
Volume 6 H Removable 0 B No Media
Volume 7 I Removable 0 B No Media
Volume 8 K NTFS Removable 14 GB Healthy
If you already copied your image into disk, you can mark MBR by using special utility called BootSect.exe shipped with WAIK. In our case (with Windows 7 embedded), you’ll have to update master boot code to use BOOTMGR (Vista and up) rather than NTLDR (XP and down)
BOOTSECT.EXE /NT60 K: /mbr
We done, have a good day and be good people. Additional information regarding USB core guys from MS can be archived from their brand new blog (hope it will be up to date).
At the end, just you to know how are CDs make by Discovery Channel
October 7th, 2009 · Comments (1)
TFS licensing model demystification or what should I buy for my company in order not to step on the licensing mine?
Microsoft loves cumbersome licensing models . This is not because of their evil-heartedness, but because it make them possible to get more from bigger companies and less from smaller. However when you come into the real decision about how many and what kind of licenses you have to purchase, you stuck. Today we’ll try to make things clearer, at least for Team Foundation Server and Visual Studio, which is very base things for any software house develops things using Microsoft technologies.
© image for cumbersomeness proposal via Willy-Peter Schaub by SA Architect
To make things even simpler, let’s assume that we do not need TFS Workgroup edition (which is special edition for TFS 5 users only) and we are not using TFS Device CAL (as opposed to User CAL this Client Access License permits one device to be used by any number of users. This kind of CAL is good for kiosks rather then for development environments). Also Test Load Agent needs it own license. So now, and under all those circumstances, let’s start.
To work with TFS we need:
- One or more Team Foundation Server
- More then one Visual Studio Client (editions can vary)
- Optional one or more Software Assurance, which can be licenses separately or together with MSDN subscription
- … and some other optional tools
TFS Licensing
Each instance of TFS needs it license. Even if you have mirrored deployment of TFS, you need a server license for each instance. Also you need separate license if you are using TFS Data Tier on SQL Server cluster or using TFS Proxy. I think it’s clear, that in addition to TFS license you’ll need Windows Server and SQL server licenses (if it used especially for TFS). You can also put Data Tier on existing SQL server in this case you need only another TFS license without SQL.
You do not need additional Team Foundation Server license for the machine used for TF build services. Also this machine does not need another CAL, except one used for the system user used for initialize builds.
To summarize: each instance of TFS need server license in addition to CALs and other server licenses (such as Windows, SQL, SharePoint, IIS etc).
Client Access License
In addition to server license you need also CAL for each used reads and writes to TFS. There are different versions of Visual Studio includes CAL:
- Visual Studio 2008 Team Suite
- Visual Studio 2008 Architecture edition
- Visual Studio 2008 Development edition
- Visual Studio 2008 Test edition
- Visual Studio 2008 Database edition
Visual Studio 2008 Professional does not includes CAL. So each one of contributes needs one of Visual Studios which includes CAL. The TFS clients might be installed on one of those editions and does requires additional license.
You do not need additional license when you are using TFS for only:
- Create work items, bugs, etc.
- Query for work items
- Update work items
Other words product definition, system analysts, managers and “bug fillers” do not required additional CAL. Note, that they will probably need proper Microsoft Office licenses to use Excel or Project to do this, however they can also use TFS web access (browser) or any other 3rd party tool without purchasing separate CAL.
Also you need only one CAL for server software. Other words, if you are using TFS on Windows Server you do not need TFS and Windows Server CAL. Also those CALs covers all earlier versions of all products in use.
To summarize: Each TFS user does not need additional CAL when he has proper license for Visual Studio Team Suite or using TFS for only bug/issues tracking.
Software assurance vs. MSDN
MSDN is more expensive then SA (Software Assurance), however it includes SA and provides some benefits by allowing access to several Microsoft products for development and testing purposes.
There are two different MSDN editions – professional and premium. The difference between those editions (except price) is that Premium editing includes Windows Server Systems and Microsoft Office. Thus with Professional edition you got software assurance for Visual Studio 2008 Professional while with Premium for all other versions.
Let’s simulate the results
For small software house with 10 developers (two architects, 1 DBA and 3 QA), two product definition guys, and manager we’ll need (in addition to OS, other server and Office licenses):
- 1 TFS license
- 2 Visual Studio 2008 Architecture edition
- 1 Visual Studio 2008 Database edition
- 3 Visual Studio 2008 Test edition
- 4 Visual Studio 2008 Development edition
- 1<n<10 MSDN Licenses Premium (as number of employees need it for testing or development purposes)
- 10-n SA licenses (if SA required)
- Additional CAL for build machine
I think, that now it become a bit clearer. For additional information regarding TFS licensing model, please refer Visual Studio Team System 2008 Licensing White Paper or ask your local licensing expert at Microsoft.
August 2nd, 2009 · Comments (15)
“Zone of Pain vs. Zone of Uselessness” or code analysis with NDepend
As for me, there are only two kinds of projects – hobbyist’s nifty tools and systems (scale may wary). The main difference between those is the easiness of making changes and refactoring. Other words, how many other developers I should persuade to do it just because “In the final analysis, it’s their war” – JFK. But what can be the good reason for such fast talk? – “You code sucks or at least it ought to”.

“Every generation needs a new revolution” – Thomas Jefferson
So, in order to win such revolution for “systems” you absolutely need static analysis tools like NDepend. Those tools are not intended for being your advocates, but those intended to help you to understand all risks and approximate the amount of work should be done to fulfill another revolution.
Unfortunately, you cannot use such tools for fair measuring of code quality because of Computer Science rules of thumb. How to decide whether “methods is too big” or “method is too complex”? However you can (and should) use it for dependencies risk detection. For example, in following illustration you can clear understand that any change inside BetterPlace.Core or BetterPlace.Model assemblies (and namespaces) can be painful.
Now the only question is who is responsible of modules, using it and how long will it take to convince them to make a revolution.
From here you can start using CQL (Code Query Language) which is SQL like language invented by Patrick, the author of NDepend, for querying code elements and sections. By using it, you can define what “method is too big” means in terms of your project.
SELECT METHODS WHERE NbLinesOfCode > 300 ORDER BY NbLinesOfCode DESC
Or see where you should replace method overloads by default arguments, introduced in .NET 4.0
SELECT METHODS WHERE NbOverloads > 1 ORDER BY NbOverloads DESC
Then, when you marked all places and human targets for revolution, you can start it. After you done, you can even compare builds and measure the amount of work and quality of results achieved.
To finalize, I just touched the tip of what good static analysis tool can be used for. So get it, learn it and use it not only when you need to make a revolutions, but also during your application design and build process to be aware about how the new monster created will looks like.
Download NDepend >>
Proper disclosure: Apr 15, Patrick, the author of NDepend, asked me to review his tool and offer one license for evaluation. I told him, that do not need to evaluate it because I’m using it for a while (also I had the license of my own) and I’ll be happy to write a review once I’ll have a bit time for it. Now it happened. Thank you, Patrick, for such good work!
July 27th, 2009 · Comments (0)
Some new in-mix downloads
There are some very cool downloads suddenly appear on MSDN download site due to all new technologies, presented at Mix ‘09. So let’s start
- Silverlight 3 SDK beta 1
- If you do not want to install full SDK, you can install only runtime for Windows or Mac. Then, you can read documentation online. You do not need it, if you’re going to install
- Silverlight 3 tools beta 1 for VS2008 SP1. After you have all this, go to the official Silverlight web site and start working.
- If you re “in” .NET RIA Services, you can download March ‘09 preview of it also to use with new Silverlight. It also makes sense to read about what is it in Brad’s blog.
- Also new Silverlight toolkit was released with SL3 support and a bunch of new up/down controls, LayoutTransformer, Accordion and TransitioningContentControl.
- Microsoft Expression Blend 3 Preview. It includes SL3 and WPF3.5 SP1 support, but excludes SketchFlow by now.
To learn more about Silverlight 3.0 and Blend 3.0, you can see first day keynotes at mix 09, Rollup of what’s new in Silverlight 3 by Joe Stegman. This includes offline mode support by Mike Harsh. I’ll write another separate post for this topic, due to the fact, that I’m a desktop guy, so wary about the future of WPF.
To learn more about how to use new Expression Blend, it worth to see this session by Pete Blois. Another good sessions are also wrapped for you by Scott Hanselman.
After we done with all web stuff, let’s speak about a client
- Microsoft MultiPoint SDK. Do you want to use multitouch in your application? This SDK provides you with ability to use up to 250 individual mouse devices simultaneously. And yes, it works with Windows XP SP2 too
- Internet Explorer 8 for Windows XP x32, XP x64, Vista x32, Vista x64
- In case, that you do no have Windows Vista or Windows Server 2008, you can download 30-day evaluation virtual hard disk of Windows Vista or Windows Server 2008 Enterprise and see how it works
. - Also a small present for my old friends (from my military consulting era) – WPF and Silverlight APIs for GIS engine of ESRI. Have a fun!
That’s all by now, going to write a review for new book and will publish it soon (probably even before, you’ll finish with all those downloads and readings). So, stay tuned and be good people.
March 20th, 2009 · Comments (1)
WPF Line-Of-Business labs and Silverlight vs. Flash
Small update today (mostly interesting links)… During my last “Smart Client” session I was asked about WPF LOB application development labs. So, there are two full labs, I noticed about:
Both labs include WPF ribbon and DataGrid, Southridge also come with M-VV-M design sample and some other interesting features. As for me, it seemed, like some parts of those labs can be easily used “as-is” for production level applications, like it was done with SCE starter, which turned into TimesReader (by the way, it has free version again).
For those, who still trying to consider what to use for their next killer app, I propose to read following article from Jordan, which compares between Silverlight and Flash. And then see composite application guidance to use Prism for Silverlight development. Here the video of it usage by Adam Kinney from Channel 9
Have a nice day and be good people
February 18th, 2009 · Comments (5)
Slides and desks from Smart Client Development session
Great thank to everybody attended yesterday at “Smart Client development” session. As promises, please see slides and desks from this session
February 12th, 2009 · Comments (0)
Bootstrapper for .NET framework version detector
You wrote your .NET program, that can be used as stand alone portable application (such as it should be for Smart Client Apps), however you have to be sure, that necessary prerequisites (such as .NET framework) are installed on client’s machine. What to do? How to detect .NET framework version installed on target machine before running .NET application. The answer is – to use unmanaged C++ bootstrapper, that invoke your application if correct version of framework is installed.
Until now there are 15 possible .NET frameworks can be installed on client’s machine. Here the table of possible and official supported versions, as appears in Q318785
| .NET version | Actual version |
| 3.5 SP1 | 3.5.30729.1 |
| 3.5 | 3.5.21022.8 |
| 3.0 SP2 | 3.0.4506.2152 |
| 3.0 SP1 | 3.0.4506.648 |
| 3.0 | 3.0.4506.30 |
| 2.0 SP2 | 2.0.50727.3053 |
| 2.0 SP1 | 2.0.50727.1433 |
| 2.0 | 2.0.50727.42 |
| 1.1 SP1 | 1.1.4322.2032 |
| 1.1 SP1 (in 32 bit version of Windows 2003) | 1.1.4322.2300 |
| 1.1 | 1.1.4322.573 |
| 1.0 SP3 | 1.0.3705.6018 |
| 1.0 SP2 | 1.0.3705.288 |
| 1.0 SP1 | 1.0.3705.209 |
| 1.0 | 1.0.3705.0 |
All of those versions are detectible by queering specific registry keys. However, in some cases, you need to load mscoree.dll and call “GETCOREVERSION” API to determine whether specific version of .NET is installed. You can read more about it in MSDN.
So it’s really simple to write small C++ application (or PowerShell applet), that queries registry and invoke your managed application. How to do this? You can either read about it in outstanding blog of Aaron Stebner, who is Project Manager in XNA platform deployment team or attend my session next week to learn do it yourself. We’ll speak about nifty ways to do it also.
Anyway, by now, you can use small stand alone program, I wrote a while ago, that will tell you all versions of .NET frameworks installed in target machine without any prerequisites. It can be run even from shared network location
See you next week.
PS: Do not forget to download and install the new version of Visual Studio Snippet Designer, which is extremely useful tool by MVP Bill McCarthy, you’ll need it later next week…
Have a nice day and be good people.
February 4th, 2009 · Comments (6)
Making TFS better or what is TITS?
Those days me and my team work very hard toward new version of “The System”. This includes massive refactoring of all solutions, hard work with TFS (which not restricted to only adding files, but also deleting, moving, etc. other words, all stuff, which TFS is not really love). Because of this, we need a bunch of handy tools to make our dreams come true and to decrease unnecessary number of clicks inside Team System Explorer and Visual Studio. You do not really think, that we have no tools to make our everyday job easier. We have. However, we never package and release it. Let me introduce “TITS” – Tools, Invaluable for Team System. This suite I’m planning to release as another open source project within couple of months.
What “TITS” includes? First of all –
“QOF” – Quick Open File
This tools is absolutely invaluable if you have big solutions. While all it knows to do is to search. But, wait, what’s wrong with build-in search of Visual Studio? First of all, it does not search Solution items and files, are in solution directory, but not in project. Also it cannot fix your typos and errors. Also it does not know to move you quickly to found solution item in Solution Explorer or in Source Editor.
Basic set of QOF features:
- No mouse – open any file
- No mouse – locate any file in solution explorer
- Highlighting found items
- Multiple files open
- Filter by source files only, resources, owner or any other kind of filters
- Search inside TFS, including history, changesets, shelves (either private and public)
- …and much much more
Next tool is:
“WIBREW” – Who Is Breaking What
Absolutely invaluable tool to know who actually breaking what file inside TFS. For example, I do not want to lock files, while I still want to know who holds what file. TFS provides such feature out-of-the-box, however from command prompt only. You can add it even as macro. Like this:
However it not user friendly and impossible for use, ‘cos it looks as following:
You do not know what actually developer doing, where and why. With “WIBREW”, you can know:
- When developer started to break files
- What exactly he’s doing
- Is the breaking file locked or now
- Where the developer breaks it (workspace and computer name of the user)
- …and much much more
Another tool is:
“WITCH” – What I have To Check-in
If you ever worked with Team Force, you know what this tool is doing. It shows you a preview of all changed files, you’ll check-in. For some reason, TFS has no such feature. Let’s imagine, that your work method is to check out everything, change something and check-in only changed files. Until here TFS does everything, however if you want to preview changeset (for example in order to compare with “WIBREW” output), you can not. Here “WITCH” comes to help.
[Here should be a screenshot of “WITCH”, but it looks exactly the same as “WIBREW” with shameless blurring]
Another invaluable tool is:
“VOCUS” – VOid CUstom Settings for check in
This tool is absolutely UI-less. It allows developers to work with their own custom settings in Visual Studio, while for check-in and check-out it format all documents, according predefined custom settings (for example indentation). How many times, you tried to merge files, when all the difference is indentation it tab size? Well, this tool solves this problem.
It stores custom settings for each user (BTW, it also makes able for each developer to restore his settings fluently in any computer) and reformat documents on check-in action toward corporate settings, when on check-out toward custom developer’s setting.
“SHMOC” – SHow MOre Code
This is not actually tool, works with TFS. It rather works with your Visual Studio Development Environment. It’s UI-less as well and makes able to hide and restore all docking windows in VS. It makes you able to write in “Dark Room” mode (which is full screen, distraction free environment) and return to Visual Studio within one button press. It can also change VS color scheme, if required.
There are some other tools should be inside this suite, however, I still have no names for them
Also, if you have something interesting, and you want to contribute it to this suite, you’re highly welcome.
PS: This blog is about code, but this post is 6th in row without even one line of code, so I have to fix it as soon as possible. Thus, I’ll example how WIBREW works under the hood. Other words, small example of how to work with TFS API from Visual Studio plugin.
First of all, as in any VS plugin, you need to acquire DTE2 application object:
_applicationObject = (DTE2)application;
_addInInstance = (AddIn)addInInst;
When you have it, you need to detect what TFS server you’re working with and what are user credentials for this session. The common problem of WIBREW for poor men, was how to work with this tool over VPN (when your connected session is only inside VS). So each time, you tried to run it, you had to enter your domain credentials – very inconvenience way of work.
In order to prevent it, let’s ask your environment about Team Foundation information:
private TeamFoundationServerExt _tfsExt;
…
_tfsExt = (TeamFoundationServerExt)_applicationObject.GetObject("Microsoft.VisualStudio.TeamFoundation.TeamFoundationServerExt");
Also, you can be notified when your work project context was changed. To do this, just subscribe to ProjectContextChanged event and handle it inside:
_tfsExt.ProjectContextChanged += OnProjectContextChanged;
…
public void OnProjectContextChanged(object sender, EventArgs e) {
if (!string.IsNullOrEmpty(_tfsExt.ActiveProjectContext.ProjectName)) {
Now when we know, that we have out active project context, all we have to do is to ask about changes
private VersionControlExt _vcExt;
…
_vcExt = (VersionControlExt)_applicationObject.GetObject("Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt");
Inside VersionControlExt object you have following self-descriptive properties and methods: FindChangeSet, History, PendingChanges, SolutionWorkspace etc. however it works only with TFS solution explorer. To handle pending changes for the project without tickling TFS, we can use it internal methods. All the difference is with references. To work with Visual Studio TFS explorer methods, you should reference:
Microsoft.VisualStudio.TeamFoundation.dll, Microsoft.VisualStudio.TeamFoundation.Client.dll and Microsoft.VisualStudio.TeamFoundation.VersionControl.dll, while working with TFS API directly, use Microsoft.TeamFoundation.dll, Microsoft.TeamFoundation.Client.dll and Microsoft.TeamFoundation.VersionControl.dll from [PROGRAM FILES]\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\. Just like this:
VersionControlServer _vcs…_vcs = (VersionControlServer)_server.GetService(typeof(VersionControlServer));…var _sets = _vcs.QueryPendingSets( new[] { new ItemSpec(serverPath, RecursionType.Full) }, null, null);…foreach (PendingSet set in sets) {…
//Get everything you need here
We done. It’s very easy to work with Team System from inside Visual Studio. Also it’s very easy to build useful tools, not built by Microsoft for some reason
Have a nice day, be good people and wait for me to beatify sources before releasing as another Open Source application.
January 27th, 2009 · Comments (9)
Open Source licenses comparison table
I have a number of projects, released with OS licenses. However, each time I’m about to release new project, I think once again about under what license to release it. So, today I decided to create small comparison table of most popular free licenses to simplify a process of licensing choose you all of us.
© Myself
| License name | Can give my name for derived work? | Should derived work remains open source? | Can change license type for derived work? | Can sell derived work? |
| Apache License 2.0 | yes | no | yes | yes |
| Common Development and Distribution License (CDDL) | yes | no | yes to compatible | yes |
| GNU General Public License 2.0 (GPLv2) | yes, but should mark changes | yes, only if published | yes to compatible or by owner agreement | yes |
| GNU Library General Public License (LGPL) | yes | same as in GPL, but can link compiled libraries as-is into non-open source software (please reference for more info) | yes for compatible | yes |
| Microsoft Public License (Ms-PL) | yes, but cannot use owner’s trademarks | no | no | yes |
| Microsoft Reciprocal License (Ms-RL) | yes, same as for Ms-PL | yes | no | yes |
| Mozilla Public License 1.1 (MPL) | yes | no | no | yes |
| BSD License | yes | no | yes | yes |
| MIT License | yes | no | yes | yes |
It’s unnecessary to mark, that all copyrights must retain in original and derived work. Also it’s good manner to notice about original authors of open source software also in derived binary work. So if you’re using my OSS in any of your work, please mark it
Please pay attention, that except MIT and MS licenses, derived work cannot use authors’ names and origin for derived software promotions.
Another common question is about Creative Common attribution under which licensed all content in this blog. It is not really license. In spite of this, you can use this attribution to mark your work. CC is all about copyright of owner attributes in derived works, but not about distribution or restrictions of any kind.
Also neither of OS licenses provide responsibility or any kind of assurance for those, who use this software as a part of derived work or in binary format.
Have a nice day, be good people, release open software to push the industry forward and show the world what you worth.
January 16th, 2009 · Comments (12)
USB FM radio library was published on CodePlex
I just published a part of my latest project – dynamic library to work with FM receivers on CodePlex under MS-PL. So, feel free do download, test and use it.
Note, that this release is preliminary and has a lot of bugs. Also, RDS is not fully implements as well as recording capabilities with Direct Sound.
I’m keep working to provide WPF UI for this library to “productize” it.
So, what are you waiting for? Download and Spear the word with this news! This is the first and only fully managed library (as far as I know) to work with RDS, TMC and FM data. Also, there are not a lot of information about HID usage as FM receiver in managed code.
Download latest release of USBFM.DLL >>
January 2nd, 2009 · Comments (8)
Discover other tags
My tools
- .NET Framework Detector
- Duplicate images finder
- Exchange Security Policy for Windows Mobile Devices Fix
- Gas Price Windows Vista SideBar gadget
- Israel Traffic Information Windows Vista SideBar gadget
- Localization fix for SAP ES Explorer for Visual Studio
- LocTester
- RTL and LTR in Windows Live Writer
- Silverlight controls library
- Snipping tool integration plugin for WLW
- USB FM receiver library
- Vista Battery Saver
- WebCam control for WPF
- Windows Live SkyDrive attachment for Windows Live Writer
- Wireless Migrator
- WPF Virtual Keyboard




