Lab Management is a great piece of software that takes great use of virtual machines in order to create virtual labs where you, your team and your testers can test out an application in a clean environment. Lab Management integrates with Team Foundation Server 2010 and thus enables you to create the lab environements out of Visual Studio with ease.

So I started upgrading our TFS 2008 with the not-so-brand-new TFS 2010, on a completely different new machine. Besides the hassle regarding upgrading the databases, prepairing the user accounts, the shared folders, the services etc. I got to the point where I had everything working (except SharePoint Services 3 integration; will talk about that later) and was getting ready to install the Lab Management stuff.

Before starting of with the real subject of this post, let me tell you, in short, the environment topology: Active Direcotory with several domain controllers running WS2003, one WS2008R2 machine running two instanced of SQL Server 2008 R2 (one for TFS 2010, one for SCVMM 2008 R2 –> it is important not to use the first instance for SCVMM), System Center Virtual Machine Manager 2008 R2, Team Foundation Server 2010 and SharePoint Services 3. Also, for running SCVMM that machine has the Hyper-V role activated.

First things are first, so I installed the Hyper-V role on my Windows Server 2008 R2 machine and afterwars System Center Virtual Machine Manager 2008 R2, because Lab Management works with SCVMM. After putting everything up and creating the SCVMM configuration to work with Hyper-V, I got the the final (and, in the end, not so final after all) point where I would configure the Lab Management in Team Foundation Server Admin Console.

So I put in the machine’s fully qualified domain name and click Test, but then suddenty a dialog box pops up requesting a user account. So I enter the user account I created for the Lab Management stuff (TFSLAB), insert the password and click Test. The credentials are fine, so I click Ok. Boom! I get this error:

TF260078: Team Foundation Server could not connect to the System Center Virtual Machine Manager Server: servername. More information for administrator: You cannot contact the Virtual Machine Manager server. The credentials provided have insufficient privileges on servername.

Ensure that your account has access to the Virtual Machine Manager server on servername, and then try the operation again.

Right. Now what? I double-check the password. Password’s fine. I double-check the username. Username’s fine. Obsiously this doesn’t have anything to do with the credentials. I check the Configuring Lab Management for the First TIme article on MSDN (here). Scroll down the site, and come across a Troubleshooting link. Click the link and come across a short text that basically tells me to check some blog or the forums. Check the blog. Nothing there about 260078. Check the forums. No similar error.

Obsiously, I’m special! Search the Web some more. After about an hour or so, I decide to post in the MSDN forums: maybe a wise man does have an answer after all. Post the error in the forum. Wait for two hours. I’m notified on my phone that someone has replied to my post. Don’t really have the time to check the post in that moment, so I’ll leave it for a couple of minutes, but than another notification alerts me! Surely I must have found gold! Two replies one after the other? Problem is as good as solved. Check the thread and find out only that someone else if trying to figure out the same thing.

Ok, enough with the introductory chit-chat.

What I did:

1. (don’t really know if it helps, or not, but this was required for similar errors) Added TFSLAB (and eventually TFSSERVICE – the account Team Foundation Service runs under) to these AD groups Pre-Windows 2000 Compatible Accessand Windows Authorization Access Group.

I tried running the Lab Configuration again, but still no luck.

2. Changed the accounts the Virtual Machine Manager and SQL Server (this is absolutely required) and Virtual Machine Agent run under to the TFSLAB account. Restart the services, but Virtual Machine Agent doesn’t start. The Service Manager posts some extremely generic error message (The Virtual Machine Manager Agent service terminated with service-specific error %%-2147217405.), so I check the Event Viewer and find this: The machine-default permission settings do not grant Local Activation permission for the COM Server application with CLSID {9C38ED61-D565-4728-AEEE-C80952F0ECDE} and APPID {5364ED0E-493F-4B16-9DBF-AE486CF22660} to the user domaintfslab SID (S-1-5-21-1004336348-790525478-1801674531-15332) from address LocalHost (Using LRPC). This security permission can be modified using the Component Services administrative tool.

As the message suggest, VMM Agent cannot start because of a component. My suspicion is that TFSLAB doesn’t have priviledges to that component, so I immediately open Component Services. However, the components are only listed by their friendly name, so I open the registry editor in order to find the component’s friendly name: Virtual Disk Service Loader. Sounds promising. I go back to Component Services, search for Virtual Disk Service Loader, right-click it in order to configure the security permission and find that everything is grayed out, as it were disabled. I check whether DCOM is enabled (right-click on the computer in the Component Services list) and find that it is.

Search online books some more and find that for Windows Server 2008 R2 Microsoft, for some “security” reason decided that Administrators, no matter their level of godness, are no longer permitted to configure anything in the Component Services and instead, a user called TrustedInstaller has acces (not even the godlike SYSTEM accound is no longer permitted acces there –> WHY?!).

Some article on the Web stated that going back to registry editor, back to HKEY_CURRENT_ROOTCLSIDidHere, clicking on the permissions option in the CLSID’s context menu (replace CLSID with that long ID your’s looking for 9C38…) and configuring the FULL CONTROL permission for the Administrator should solve the problem. However, it didn’t. What I did though (as a temporary resort, because it was getting frustrating) was to add the TFSLAB account to the local admin accounts group.

So, in conclusion:

  • add the TFSLAB account to the local admins
  • add TFSLAB to the AD built-in groups I mentioned earlier
  • run SQL Server instance service with the TFSLAB account
  • run the VMM service with the TFSLAB account

and you should have everything up and running (after finishing the configuration, of course).

Till next time,


I was talking today to another follower of the OradeaDevs Facebook page ( about querying data on a specific set, based on whatever column, e.g. Name.

Considering a Product table which has the following columns IDProduct, ProductName, one would probably try to query the set-data by using something we call a sub-query select (or sometimes inner select). Even though the expected result is correct, in my opinion it is best to stay away from any kind of sub-queries, because these are usually the reason for why SQL databases respond slow (after the use of cursors, of course). Keep in mind that even if you’re Chuck Norris and do some sort of magic indexes configuration, once the SQL query engine will scan the clustered/non-clustered index tables, spool the tables over and over again, remove the carthesian products resulted from the subquery values etc. the query result will respond slow.

In my opinion, it is best have a larger set of the data kept in a buffer memory-like area and query the last set from there. For example, if one would like to query the entries, ordered alphabetically by their name, from 21 to 30, it would be a better solution to query the data from 1 to 30 and afterwards to query the last 9 values (which is bassically the case of using a simple WHERE clause).

And since it comes to temporary data tables, considering SQL Server 2K5 is around for some time now, I would suggest the use of common table expressions, which are a great way, from the performant p.o.v., to save your temporary data you want to query on.

So, there the use of a CTE which lists the entries between 29989 and 30000 of a table called Product, ordered by their product name:

WITH TopCTE AS (     SELECT TOP 30000        ROW_NUMBER() OVER(ORDER BY ProductName) AS RowNumber, ProductName        FROM Product        ORDER BY ProductName ) SELECT *     FROM TopCTE     WHERE RowNumber > 29990

That’s it for now!


Hey guys! These were truly some days when evil was hovering over me!… or at least, so I thought!

I’ve been trying since last Saturday to deploy a Win CE application I’ve written in C# for a new embedded board I’ve received from Microsoft as a prize, but I kept getting this annoying errors, like “the Compact version used is too old” or “the application is already running” (and of course, it wasn’t running) and so on.

Since I’ve got that first error, I believed that there was a problem with the WinCE image I’ve built. So, just to be 100% sure that the problem was the image (which I admit, didn’t find to have build-logic problems), I’ve tried deploying the image on another older board, with another image of course, also on an x86 architecture, an image that I knew was perfectly capable of running anything I had in mind.

But what about this? I plug in the cross-over cable, boot the image, run Coreman for deploying the app I’ve written and boom: “Deployment and/or registration failed with error: 0x8973190e. Error writing file ‘’. Error 0x8007274c: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.” I try the Coreman again, run the debug again, and then I get “the process is already running bla-bla-bla”.

So what to do next? Well, first I was thinking of writing an e-mail for support, but whom to write to? And what to write? Writing an e-mail with “nothing works” as subject, and the posted error in the body of the e-mail would have probably been ignored… And then it came to me: what if the network board is broken (to be read as f***** up”)?

A short history lesson: back in December I had to buy a new network board for my laptop because I’ve accidentally broken a pin of the original on-board Intel gigabit network board. And since it isn’t possible to change the on-board network module, I’ve decided to buy the best PCMCIA network board on the market: the D-Link DGE-660TD Gigabit board.

Enough with the history lesson. So here I am, unplugging my D-Link network board. I dock the laptop in the Lenovo docking station, plug the cable into the docking station network socket, change the IP addresses as required, start Coreman all over again, press deploy and taa-daam: deploy succeeded.

Don’t know if any of you ever had similar problems, but googling any of the errors I’ve got during these last 4 days I had absolutely didn’t help at all, so…

Ok, that’s it for today!


This was a rough morning, all right! Especially since it was so difficult to insert an ampersand (&) in that freakin’ label!

So the problem is that & is used for the mnemonic function (you know… in case you want the File menu to pop up when you press the ‘F’ key on your keyboard, you would name the File menu as ‘&File’).


Therefore, having a label text called ‘a&b’ would require:

1. disable the menmonic function: UseMnemonic = False

2. change the label’s text to a&&b


I admit it’s kind of lame to have a post about this, but you just might wonder one day why your label isn’t listening 🙂

Sometimes, just sometimes, it’s very frustrating to search for something that isn’t there, isn’t it? 🙂

I was trying to make a tutorial on how to use the built-in setup and deployment system that VS05 offers in the form of Setup and Deployment projects, and the result was that I was ‘hanging’ at the customization part, specifically at changing things like the ‘default company name’ tag. Why is was so difficult? Well, basically, because it just wasn’t there.

After googling around, I even found out that the tags can be changed using some key inside the HKLMSOFTWAREMicrosoftWindows NTCurrentVersion, but this is totally unacceptable, of course (to be honest, I didn’t even succeed in that method either).

So I’ve been looking and looking for about 1 hour for those impossible-to-find tags, when I finally decide to dock the Properties windows and surprise: there they are.

Take it like this: right-click-ing the Setup project created inside the solution brings you to the Setup Property Pages windows, which contains a set of completely different properties than the ones listed in the Properties toolbox. This is frustrating and confusing, since almost everything in VS works different: right click-ing a component in Solution Explorer toolbox (or even Catalog Item toolbox) will either pop the Properties toolbox or pop a windows with the mostly the same properties listed in the Properties toolbox…

So, whenever you are looking for changing the default tags from a setup project, remember to check the one and only: PROPERTIES TOOLBOX. 🙂

Alex 🙂

coming up next: how to create an installer with a professional feeling, sparing the $1000+ required for InstallShield or InstallWise.

I’ve just realized there is no working solution in C# on how to programatically select cells across a dataGridView.

What I needed was a quick, simple and easy solution on the next behaviour: a user clicks a cell (any kind of cell: may it be a textBox cell, a checkBox cell, a comboBox cell etc.), the cell gets selected, the user clicks another cell, both the new cell and the previous cell are selected, the user click the first cell again, only the second cell is selected.

How I’ve done this? Well, first, it’s important to keep in mind that the events occur like this: CellMouseDown, CellClick, CellContentChanged, CellMouseUp, SelectionChanged. Sure, there are so many other events as well, but it’s important that you use only the CellContentChanged and the SelectionChanged events. Moreover, be aware, that if you try using the CellClick event, you won’t get this desired behaviour :).

What’s more to add, please keep in mind that you will have the MultiSelect property set to True. It would be also nice to have the SelectionMode set to CellSelect, so you don’t need to take care of several exceptions that could occur if you select the entire row/column by clicking on the column header or row header.


– first, declare a System.Collections.ArrayList arrayList = new System.Collections.ArrayList(); This is where you will save a list of all of your selected cells. Sure, it would be nice to save the SelectedCells collection of the DataGridView, but that collection is obviously read-only. Otherwise, I probably wouldn’t even have this post :P.

– second, in the SelectionChanged event, do this:

foreach (DataGridViewCell arrayElement in arrayList)
arrayElement.Selected = true;

And in the CurrentCellChanged, do the following:

if (dataGridView1.CurrentCell != null)
label1.Text = (dataGridView1.CurrentCell.RowIndex + 1).ToString() + ” ” + (dataGridView1.CurrentCell.ColumnIndex + 1).ToString();
if (arrayList.Contains(dataGridView1.CurrentCell))
dataGridView1.CurrentCell.Selected = false;
dataGridView1.CurrentCell.Selected = true;

This is basically it. Now, there is a thing about this code. The thing is that is you click on a column header, in order to re-sort the column, you’ll have a rather strange “error”: your last selected cell will get de-selected. If you re-sort the column again, the cell will be selected again. The fault of this occurrence is due to the way the events are called. Basically, when you click the header, the CurrentCellChanged is called for a first time, since you clicked the header (so, dataGridView.CurrentCell will be null). Afterwards, the CurrentCellChanged is automatically called again, because current cell’s position is moved (so the event is called for some reason…).

There are several ways to get along with this thing; I’ll let you find your own solution, since:

  1. I for one, needed NonSortable columns
  2. I needed the column headers hidden

Alex M.

I have had some trouble changing the ScrollBar’s width in an application I’ve been asked to modify. Obviously, the first thing to do was to search for a Size property for the panel’s scroll bar. Just as expected, there wasn’t any. What could I do more? Surely Google (or Bing…) would have the answer!

But surprise! No good answer on the first 6 pages that Google showed up. So I started checking the Components toolbox again, and there it was: VScrollBar.

It is probably the best way to have a larger scroll bar in your application, since this component has a Size property. Linking the component to the form or panel you want to scroll is as easy as enabling the component’s Scroll event and writing down

panelName.VerticalScroll.Value = vScrollBar.Value;

Now, if you want to be 100% sure about how the scroll bar looks like, simply set the component’s Maximum property to the difference of the panel’s length (should I call it height), and the portion of the panel that is not showed (the one that should be scrolled for…).

In the end, I suggest you use a panel, for easier and safer usage of the vScrollBar.

Hope the post is clear enough. If not, don’t hesitate to ask your question in a comment.