Monthly Archives: April 2009

How to Get Rid of the Pesky antivirus Check When Sending Files in MSN Messenger…?

UPDATE: When receiving a file, using the simple “cmd.exe” causes the command prompt to show. To get around this, use the /c “exit”. This will simply execute the exit command and continue, causing a command prompt to flash quickly:

cmd.exe /c “exit”

The boffins who build MSN Messenger decided a few revisions ago to introduce a security check into messenger that doesn’t allow you to send files such as zips to other contacts unless you have antivirus installed. It’s a nice feature to stop 12yr old girls from sending around, but it’s quite annoying if you’re running an OS like Windows 7 with UAC on because the need for antivirus software is only as great as your stupidity for accepting crappy files. In fact, I have been antivirus free on my laptop for the past year just because I don’t see the need for it when UAC is on and simple precautions are taken.

Anyway, I tried to send a valid zip to my colleague today and got the little warning.


Of course, I can’t continue because I don’t have antivirus installed. Or can I…?

I clicked Options and got my File Transfer settings.


Then thought, what would happen if I just told Messenger to use any old app, like say cmd.exe, as my scanner…


Try again…


w00t! 🙂

Quick Commerce Server Post – NotSupportedException on ResetPassword

As the resident CS go-to guy, I was hit up with a bug about a whacky exception message that was exposed whenever a user tried to reset their password. The stack trace resembled the following:

System.NotSupportedException – Microsoft.CommerceServer.Runtime, Specified method is not supported.

at Microsoft.CommerceServer.Runtime.Profiles.UpmMembershipUser.ValidateUserAnswer(String answer)

at Microsoft.CommerceServer.Runtime.Profiles.UpmMembershipUser.ResetPassword(String passwordAnswer)

After staring at it for a couple of minutes and looking precisely at where we called it for a while I opened Reflector and gave it a crack. The UpmMembershipProvider and associated classes are in Microsoft.CommerceServer.Runtime.dll, found in C:\Program Files\Microsoft Commerce Server 2007\Assemblies.

Looking at UpmMembershipUser.ValidateUserAnswer(string answer), I found it used a variable called RequiresQuestionAndAnswer to determine whether validating the answer is required and throws a NotSupportedException if it is not. This variable was set in the UpmMembershipSettings class’ GetProfileConfiguration() method as follows:

this.requiresQuestionAndAnswer =

   inspector.DoesProfilePropertyExist("GeneralInfo.password_question", "STRING")

  && inspector.DoesProfilePropertyExist("GeneralInfo.password_answer", "STRING");

This tells me that the way we determine whether we require a Question/Answer combination to reset the password is actually by seeing whether the question and answer properties are exposed on the UserObject profile. Much to my dismay, these properties had been removed by someone…

Looking at the code again, I realised that an empty string was being passed through to ResetPassword because a custom answer validation was being performed in code before that. In the end, simply removing the parameter or passing null fixed this issue because ResetPassword() calls ResetPassword(null) which causes another branch to be executed that does not call the method ValidateAnswer.

Doing a quick search through the codebase revealed that there was another part of the system that called the method without a parameter. In fact, the same 3 lines were repeated almost exactly…

string generatedPassword = membershipUser.ResetPassword();
membershipUser.ChangePassword(generatedPassword, e.NewPassword);

Lessons learnt:

  1. Reflector is AWESOME!
  2. Put common code in an accessible place…

Using a VHD to Store stuff in Windows 7

Firstly, I’m not taking the credit for this one. It was Paul Stovell’s idea, but because he’s currently blogless I’m going to post it on mine… 🙂

The other day Paul was talking about a way of utilising the new VHD features of Windows 7 to keep all his documents and important stuff in a single location so that he can back them all up by copying one file. He had created a VHD and written a script that mounts it as a drive at start up. I thought this was a great idea, so I reproduced it and am now sharing it.

Firstly, create the VHD either using Virtual PC or the Disk Management console Action > Create VHD. Attach the VHD in Disk Manager then initialise and format it. Detach it and we can start scripting the attach process.

Create a text file named “Attach VHD.txt” with the following contents in %windir%\System32\GroupPolicy\User\Scripts\Logon entering the location of the VHD:

SELECT VDISK file="<Location of VHD>"

NOTE: I’ve used U as the drive letter. You can change this if it will cause a conflict or you just don’t like it.

In the same location, create a batch file named “Attach VHD.cmd” with the following contents:

DISKPART /s "Attach VHD.txt"

Open the group policy editor (Hit Start then type “group policy”) and drill down to User Configuration > Windows Settings > Scripts (Logon).


Open the the Logon script properties and add the batch file you just created (it should open the location you created the files in by default).


Now, log out and on again. It may take a few seconds, but the autorun screen should pop up when the drive is attached. Open Windows Explorer and you will see a new drive in your tree.


That’s it!

I’ve actually now moved all my user folders (i.e. Documents, Music, etc.) to the VHD, but if you don’t want to do that you can just use the libraries to include a folder and set it as the save location.

My Visual Studio Colour scheme

Ok, so here’s the current version of my colour scheme

What’s it look like?


Hope you like it. 🙂