Archive for July, 2009

Test mail send routine without mail server

I picked up a blog post about this tip from one of my RSS feeds. Amr ElGarhy posted a valuable article on how to write emails to a local directory rather than sending them through a mail server. This saves a lot of time in dev.

Essentially, replace your existing mail configuration with the config below:

<system.net>

<mailSettings>

   <smtp deliveryMethod=”SpecifiedPickupDirectory“>

    <specifiedPickupDirectory pickupDirectoryLocation=”c:\tmp” />

   </smtp>

</mailSettings>

</system.net>


When you send a mail using the built in .NET classes, a *.eml file will be created in the directory you specify. You can then view the email by simply opening the file.

Enable remote desktop remotely

So, this morning I needed to remote into one of our work stations at the office but lo and behold, remote desktop was disabled (ARGGH!). This meant one of three things, either I drive to the office to get it done, forget about the work until Monday or try update the setting remotely. Suffice to say, I attempted option 3 first.

It turned out to be really easy, there are already one or two articles on the web that explain how to do this, but for the folks who don’t know (and for my future reference) I thought posting it here would be useful.

Step 1 – Download PsExec (an awesome utility from SysInternals)

http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

Step 2 – Run PsExec as follows:

psexec \\REMOTE_PC_NAME _HERE cmd

This will open a command line session on the machine you are attempting to enable RD on. Any of the commands you execute below will be executed on the remote machine.

Step 3 – Ensure the firewall on the remote machine lets you in

netsh firewall set service remotedesktop enable
netsh firewall set service remoteadmin enable

Step 4 – Update the terminal server registry key which controls remote desktop capability

REG ADD “HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server” /f /v fDenyTSConnections /t REG_DWORD /d 0

That’s it! You should be good to go.