Friday, October 30, 2009

Ubuntu Gateway Server - Installing Windows

The installation for Windows Server 2003 w/ SP2 went very smoothly. VMWare comes with a handy auto-installer that did all the work for me. After booting from the CD-ROM, I gave VMWare my key along with some default settings, and it did all the work. I went to work after starting the setup. When I returned, I had a Windows Server to play with. My next task was to install ISA Server 2006. This is where I ran into some hiccups.

In the real-world scenario, I will be setting up ISA Server using Remote Desktop onto a remote server. Wanting to simulate this scenario to see possible issues, I went ahead and did a Remote Desktop session into my server. I mounted the ISA Server 2006 .iso and began the installation. Everything here went smoothly. I then decided to install ISA Server 2006 SP1, and this is where I ran into issues.

After downloading and installing ISA Server 2006 SP1, I rebooted the computer (Do keep in mind that I am doing all this through a Remote Desktop session.). Then, when it came back up, I configured my server. Finally, I ran Windows Update and rebooted again. This time, however, I could not reconnect to my server via Remote Desktop. Further inspection into the Event Viewer revealed the the ISA Server firewall service had crashed!

Further research indicated that there was indeed an issue with ISA Server 2006 SP1. For more information, see the Microsoft Knowledge Base articles 956269 and 970443. This was a serious issue, because any crashes would permanently lock me out of the real machine I would be using (Which is a rented server that is being housed in a data-center far far away!). So, I uninstalled ISA Server from the VMWare console and decided to try again. This time I was successful. I came up with the following installation steps:

1. When installing ISA Server 2006 with Remote Desktop, you must be using Remote Desktop from a computer that has a static IP address. By default, ISA Server locks down everything. The exception is that, if it detects a Remote Desktop session, it will add the client computer's IP address to the 'Remote Management Computers' group. This will allow you to continue to be able to access the server remotely in spite of the firewall locking down everything.

2. After installing the software, reboot the computer once.

3. Immediately after reboot, install ISA Server 2006 SP1, but DO NOT REBOOT!

4. Immediately after installing SP1, install the two hotfixes mentioned previously. Do NOT REBOOT until the second hotfix is installed. Once you have installed BOTH hotfixes, then it is safe to reboot. Your computer should safely come back online, allowing you to further configure the box.

5. At this point, you may want to allow remote access to the server from other computers. You can do this by:
  1. Right-click the 'Firewall' option in the ISA Server Management Console
  2. Select 'Edit System Policy'
  3. Under 'Terminal Server,' choose the 'From' tab
  4. Edit the 'Remote Management Computers' group
  5. Add a new subnet: 0.0.0.0/0 and call it 'All Computers'

Ubuntu Gateway Server - Introduction

During the next several weeks, I am going to be configuring Ubuntu Linux Server as an Internet Gateway and Router. The server will perform several key tasks:
  1. NAT Internet traffic from my internal network to the Internet
  2. Function as a DNS server for my internal network
  3. Function as a DHCP server for my internal network
  4. Establish and maintain a slightly complex IPSEC VPN scenario
Throughout these articles, I will be setting up a fake test scenario inside VMWare. I will be setting up three VMWare machines. Two of them will be Ubuntu Linux Server and one of them will be Windows Server 2003 w/ SP2 running ISA Server 2006 w/ SP1.

During this simulation, each VMWare computer will be assigned two network adapters: one for the computer's "internal" network and one for its "external" network. In all reality, the external network will be my true private network. The following IP settings will comprise my simulation network:

Ubuntu Server 1:
  • Public IP address: 192.168.27.20
  • Public Netmask: 255.255.255.0
  • Internal IP address: 192.168.50.1
  • Internal Netmask: 255.255.255.0
Ubuntu Server 2:
  • Public IP address: 192.168.27.21
  • Public Netmask: 255.255.255.0
  • Internal IP address: 192.168.51.1
  • Internal Netmask: 255.255.255.0
Windows 2003 Server:
  • Public IP address: 192.168.27.22
  • Public Netmask: 255.255.255.0
  • Internal IP address: 192.168.51.1
  • Internal Netmask: 255.255.255.0

Wednesday, October 28, 2009

Double-clicking an Excel file does not open it

I received a call from a customer in distress today. They could not open Excel files by double-clicking on them. When they tried it, they received an error relating to Excel not being able to find the file. It said something along the lines of "Make sure you typed the name correctly..."

The customer is using Windows Vista with Microsoft Office 2007. I found a blog entry on the topic at http://www.vistax64.com/vista-general/45766-messages-make-sure-you-typed-name-correctly-4.html. For easy reference, I am posting it here as well:

"All pissing aside, here is the solution to clicking an excel file and
having Windows tell you the file is missing...
To resolve this problem, follow these steps:
1. In Microsoft Office Excel 2007, click the Microsoft Office Button,
and then click Excel Options.
2. Click Advanced, and then click to clear the Ignore other
applications check box in the General area.
3. Click OK.
1. In Microsoft Office Excel 2003 or earlier versions of Excel click
Options, on the Tools menu.
2. Click the General tab.
3. Click to clear the Ignore other applications check box, and then
click OK.
After you do this, you should be able to open workbooks by
double-clicking them in Windows Explorer."

Recursively Delete Subversion Folders



I like to script things like this when I can, for many reasons. First and foremost, I prefer to write programs that do repetitive work for me instead of doing the repetitive work myself. Second, writing little helper scripts like this allows me to share them with my team, boosting their productivity as well. Lastly, as an exercise for me to learn and practice the obscure art of Windows batch scripts. Here is the command as it would be run from a prompt in the root directory where you want to delete .svn directories:
for /r %R in (.svn) do if exist %R (rd /s /q "%R")
Let me break this down. The command starts with for /r %R, which is the recursive form of for. It will recurse through the directory tree, starting in the current directory. In each directory visited, the for variable %R will be set to the for command’s current directory and the rest of the command will then be executed. The next part of the command is in (.svn). This part of the command specifies the patterns that will be matched in each directory visited by for /r. The thing to be aware of here is that the pattern will be repeated in every directory whether or not such a file or folder actually exists. You could just brute-force your way through the folder tree and try removing the .svn directory in every subdirectory, but the output of that would be cluttered with error messages stating that the .svn directory does not exist. Therefore, the next part of the command is an existence check: if exist %R. Just like it sounds, this will only evaluate to true when the directory contains a file or folder named .svn. Finally, the command to remove the directory rd /s /q “%R”. The /s parameter makes the command recursive, and the /q parameter suppresses confirmations.
As handy as this command is, it would be even handier and easier to share if it was a batch script. Here are the modifications necessary to make the command run in a .bat file:
for /r %1 %%R in (.svn) do if exist "%%R" (rd /s /q "%%R")
The first difference you will notice is the presence of a new variable, %1. This variable represents the first parameter passed to the batch file. For this script, the first parameter is the root directory where we want to recursively delete .svn directories. I’ll explain the usefulness of that in a moment. The second change is that all of the references to the for variable %R are renamed to %%R. This is a necessary modification thanks to the way that for command variables are parsed inside of batch files. Let’s create a new file, paste the above command into it, and name it delsvn.bat.
Now that we have this command in a batch file, there are three ways to use it. The first is to call it via command line e.g.
delsvn.bat "drive:\path\"
The second way is to keep the batch file nearby where there are directories that need to have .svn folders removed and drag and drop the folder onto the batch file. This will make the dragged folder’s path be the first parameter of the batch file.
The final way, which makes it easy to invoke the batch file from anywhere, is to add a shortcut to the batch file to the Send To menu. Once the batch file is added there, you can right-click on any directory, choose Send To, then choose the shortcut to the batch file. Just as with the second option, when you send a folder to the shortcut, it will make the folder’s path be the batch file’s first parameter.
There is actually one more way I can think of to re-use this script, and that is to add it as a context menu to directories by modifying the Registry. This is definitely a viable option, but it is a little more involved and also involves a little bit of risk unless you know what you’re doing. Unless you are comfortable hacking around in the Registry, I would not recommend this option.