Getting .dll files out of the GAC

Periodically, you may find it necessary to get a copy of a .dll file out of the the GAC (C:\Windows\Assembly).  Navigating to this folder, you will notice it doesn’t “feel” like a normal windows folder since it isn’t.  You can drag .dll files onto this folder to install, but you can’t drag anything out of it.  This happens due to the shfusion.dll explorer extension dll that format the GAC folder.



So if you want access to these .dlls, you can unregister the shfusion.dll

regsvr32 /u C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\shfusion.dll

and you should see a message like this:



Once you have unregistered the .dll, you can browse to the assembly folder and you will notice that the underlying folder structure is exposed:


If you’re looking to grad several .dlls out of the GAC, you can use xcopy or some other tool to flatten out the folder structure.


string.format("{0} Architect{1}", "Over", "ed")

As an enterprise software architect, there are many difficult problems that I face at work.  Most of the time, these problems require an elegantly architected solution that promises to be both maintainable and efficient at the same time.  This is always a difficult balance to achieve. 

The thing that surprises me most is that many people have a skewed view of maintainability.  An application that is maintainable does not necessarily mean that it is simple to configure, refactor, or extend.  While these characteristics of software are good ones, they do not make software easy to maintain.  Ease of maintenance to me means that a developer with good fundamental skills can understand, support, and modify code.  Often times, the simplest software is the easiest to maintain.

Which brings me to my key point: Many software systems are overarchitected

While that word came up as a spelling error in my editor, I am quite confident that the concept exists.  You know the stuff I am talking about — Code that is ridiculously complex in the name of architectural purity.  Code that has hooks for uses that only the designer/developer were able to dream up and that the user or support tech will never understand or use.  If these extraneous bells and whistles cause you to expend brain cycles on goals other than making the software meet the requirements, the exercise is purely academic.

This is why is pays to have experience in the problem domain for which you are writing software.  If you understand what things the user may want to do, you can add the right hooks in (and none of the wrong ones).  Take the title of this blog post as an example.  I have plenty of flexibility as I have a plethora of options for switching out my title.  Heck, I could even put it in web.config!  But alas, does that really buy my anything to be able to easily switch my blog post tile to “Under Architecting”?

So before you amaze yourself with your coding prowess, think about what it is you are doing.  Is it a requirement for you application?  Would it be used any more often than once per ice age?  Did you only do it to prove that you could?

A little common sense goes a long way…

WMIC Wildcard Search using like and %

This is a quick post to provide some detail on using the wildcard search for WMIC.  This feature of the command structure will allow you to use like conditions in a where clause to look for objects that match a specific pattern.  For those of you comfortable with the SQL syntax for the same task, this will be quite familiar.

Background – Regular WHERE clause

First, let’s look at using WMIC without wildcards for comparison.  All of the statements below are run while at the WMIC command prompt.  To get to the WMIC command prompt, simply go to a Windows command window and type WMIC.

Command to show you all of your services

  • service

Command to show you all of your services that are running

  • service where state=”Running”

Command to show you specific data about your services that are running

  • service where state=”Running” get Name, DisplayName, PathName, ProcessID

Filtering it Down – the LIKE Operator

So you’ll notice that the list of services you have running is a bit difficult to sift through as there are a lot of them.  You can always export this list to a text file by calling WMIC with that command line and piping to a text file, but when you are looking for a specific set of data, I like elaborating on the where clause.  The key thing to keep in mind here is that you need to enclose the full where clause in double quotes to keep it as a single string.  As you’ll notice above, it is possible to use state=”Running” by just not using any spaces in the clause, however that doesn’t work with like.

For example, this will not work

  • service where PathNamelike”%SQL%” get Name, DisplayName, PathName, ProcessID

But this will

  • service where “PathName like ‘%SQL%'” get Name, DisplayName, PathName, ProcessID

The body of the where clause needs to be wrapped in quotes to make it a contiguous statement that does not get confused as multiple arguments.  There are a couple of interesting conveniences that should be noted about WMIC in general

  1. Using single or double quotes seems to be largely interchangeable
  2. Keywords and commands are not case sensitive

So the trick is that you need to use a slightly different and more complex syntax in order to use the like and % functionality.  Taking this command syntax full circle, you can use the more complex syntax all of the time to avoid confusion

  • service where “state = ‘Running'”

Using this wildcard filtering functionality is one of the most powerful uses of WMIC that applies to your everyday tasks.  You can combine this with the other powerful WMI functionality such as killing processes, starting or stopping services, etc.  So if you wanted to stop all of the services on your server that are running a particular application (we’ll say Widget.exe), you could do something like this:

  • service where “PathName like ‘%Widget.exe%'” call StopService

WMIC continues to be very useful in my work, so I hope you find this post helpful in your activities!

VSS Labeling Problem – File $/path/ is already open

Recently, while using the source control system that everyone hates (but seems to continue to use), I was trying to apply a label and got the following error:


The path name blurred to protect intellectual property, but this was a path in VSS, not a file.  When trying to apply a label to the folder I got this message.  I noticed that it seemed to happen on certain folders, but not others.  For the folders it did occur on, it would say image down in the status bar for about a minute before coming back with this error. 

This may or not help you, but I will share the steps I used to resolve this error.

  1. The first important step to resolving this issue was narrowing it down to the specific folder where this problem was occurring.  In my case, this was simply trial and error of applying labels at each folder until I honed in on the culprit.
  2. Next, check out all of the files in that folder.  In my case, there were about 2 dozen files.  When checking them all out, I got a message in the status bar that was suspicious:

Could not checkout local version of $/<path>/<filename>, checking out latest version instead.

So at this point, I tried checking the file out and back in with no change in the behavior.  My problem still persisted and I was not able to label that file or any parent folder of that file.  Arrrrgghh!

So while I have narrowed it down, no solution yet.  Please contribute any comments or resources you have that may help here.  I’ll continue to investigate and will likely be running SS ANALYZE next…

Saving Changes is Not Permitted?

In order to test drive the data modeling features of SS2008, I decided to use the engine for a real-world application.  I’m now attempting to use SQL Server to manage the Bateman household.  My first table in the design is a simple list of chores that we need to make sure get done around the house.

As I was putting together some of the details about how I would use this data, I decided to add a new column in order to specify the frequency (in days) which each chore should ideally be performed.  I was quite surprised to get the following error message when tying to add a nullable column to my existing table.


Saving changes is not permitted.  The changes you have made require the following tables to be dropped and re-created.  You have either made changes to a table that can’t be re-created or enabled the option Prevent saving changes that require the table to be re-created. 

Are you kidding me?  It wouldn’t let me add an “Allow Nulls” column?  That just seemed absurd so I did a bit more digging.

Apparently, this is now the default behavior for any of the following changes to a table:

  • Adding a new column to the middle of the table
  • Dropping a column
  • Changing column nullability
  • Changing the order of the columns
  • Changing the data type of a column

In order to prevent this default behavior, you simply need to uncheck a box in the table designer options using the Tools -> Options menu item


Expand the Designers section to display the Table and Database Designers options.


To change this behavior, just uncheck the “Prevent saving changes that require table re-creation” checkbox.

Although this is a bit frustrating, at least it is easy to fix and there is plenty of advice out there.  Here are some other people that found and posted this useful tidbit before me:!98EC8584C8BBED54!849.trak

Cool New Features in SSMS – Recent Expensive Queries

Depending on whether you are more of a developer or more of a DBA you may care more or less about this next feature.  However, anyone can benefit from it.  SSMS 2008 makes it very easy to crack open the Activity Monitor as there is a noticeable button right on the toolbar.


Once inside you get a few charts, as well as some tables of performance related data below.  This is clearly not as exciting on my local Vista machine as it would be on a pounded production database, but you can see where the power of a tool like this could come in handy.

Each of the charts represents these metrics:

  • % Processor Time
  • Waiting Tasks
  • Database I/O
  • Batch Requests/Sec

Probably the most interesting feature to me is the Recent Expensive Queries table.  This allows you to dynamically analyze the most impacting queries against your server.  Since the impact can be determined by a number of factors, it allows you to sort by:

  • Executions
  • CPU
  • Physical Reads
  • Logical Writes
  • Logical Reads
  • Average Duration
  • Plan Count

Even cooler, you can drill into the actual query itself with a right-click option:


Cool New Features in SSMS – Select Top 100 Rows

As I have been playing with the newest version of Microsoft’s SQL Server Managements Studio (SSMS), I wanted to share a few of the cool new features.  It seemed that the jump from Query Analyzer in SQL Server 2000 to SSMS in 2005 was not necessarily a smooth one and many people complained about SSMS.  This new version, however, appears to build on the solid framework of 2005 and add lots of cool features that will make our lives much easier.

Select Top 1000 Rows

Just grabbing a sample of data out of a table has been made much easier in 2008:


It is also good to see that this has been made configurable in the Tools->Options menu item:


You’ll notice that there is also an “Edit Top n Rows” option.  This is arguably less useful as I haven’t found anywhere to specify which 200 rows, but still a noble effort.  I don’t often find myself thinking, “Hmmmm, I think I would like to edit some random data.  Let me just pull up any old record and start changing the data.”  However, once in edit mode, you can always use the “SQL” button (in green box below) to change your query: