Tuesday, October 20, 2009

RDP to Console

Ok, so we know to use the /admin switch when running mstsc from the command line if we want to RDP to the console session, but I keep forgetting the RDP file entry to do the same thing, so I'm recording it here for posterity:

administrative session:i:1

B

Thursday, September 10, 2009

W2k3 ICMP Types

For reference, here's the ICMP types on Windows 2003:

2 - Allow outbound packet too big.
3 - Allow outbound destination unreachable.
4 - Allow outbound source quench.
5 - Allow redirect.
8 - Allow inbound echo request.
9 - Allow inbound router request.
11 - Allow outbound time exceeded.
12 - Allow outbound parameter problem.
13 - Allow inbound timestamp request.
17 - Allow inbound mask request.
ALL - All types.

Enable ICMP Response on W2k3 Firewall

To enable ICMP response on a Windows 2003 firewall, use the following command:

netsh firewall set icmpsetting type = 8 mode = enable interface = "Local Area Connection"

Watch those spaces!

Thursday, September 3, 2009

Select Passive Mode in Windows FTP Client

I always forget what the command is to change the Windows FTP client from Active to Passive mode, so for reference the command is:

LITERAL PASV

Happy FTPing!

Monday, August 31, 2009

Enable ICMP Response on W2k8 Firewall

The firewall on Windows Server 2008 is turned on by default and ICMP echoes are disabled. According to Microsoft you should be able to enable it using:

netsh advfirewall firewall add rule name=”ICMP Allow incoming V4 echo request” protocol=icmpv4:8,any dir=in action=allow

The result of this is "An invalid value was specified" which makes sense if you look at what netsh should be provided with. Rather than adding this custom rule, I had a look to see if there was a rule already there, but disabled. There is, but it's called "File and Printer Sharing (Echo Request - ICMPv4-In)" for some reason.

So, to enable it use:

netsh advfirewall firewall set rule name="File and Printer Sharing (Echo Request - ICMPv4-In)" new enable=yes

Happy pinging.

Thursday, August 27, 2009

GUI vs CLI

I always lament the way Microsoft seem to insist on changing user interfaces, seemingly burying things I need to configure one or more clicks away in successive versions of Windows, or implementing "Wizards" which require you to click fill in a piece of information, click Next, fill in another piece of information, click next, and so on. (At the risk of sounding like an old man) I liked the way things were in the NT days e.g. if you needed to configure a WINS Server, most of the settings you needed were presented in a single properties page e.g.:



This allowed you to enter everything required and hit OK once instead of hitting Next umpteen times.

Thankfully there isn't a Wizard (yet) for setting up IP addresses, but there's still a significant number of mouse clicks required to get the job done. At least the command line is never more than six key strokes away (Windows Key+R - cmd - Return). So rather than wearing out the button on your mouse, the next time you need to configure IP addresses at the command line, try netsh instead:

Set an IP address
netsh interface ip set address name="Local Area Connection" static ip mask gateway metric e.g.:
netsh interface ip set address name="Local Area Connection" static 10.10.1.100 255.255.255.0 10.10.1.1 1

Primary DNS
netsh interface ip set dnsserver name="Local Area Connection" static DNSServerIPAddress e.g.:
netsh interface ip set dnsserver name="Local Area Connection" static 82.195.128.192

Secondary DNS
netsh interface ip add dnsserver "Local Area Connection" DNSServerIPAddress e.g.:
netsh interface ip add dnsserver "Local Area Connection" 82.195.146.192

Saturday, June 27, 2009

Seven Million Files on NTFS

I had occasion to look into performance problems on a Windows 2003 server the other day. The server is running IIS and generally runs along tickety-boo. Then someone started to delete some files from an NTFS volume and the server practically locked up. That's when I was called in.

I quickly discovered that the one volume had approximately seven million files files on it. This amount of files will pose probems: even if the application(s) using the volume can cope, explorer.exe won't fair so well.

I've never been particularly impressed with Explorer's performance when large file operations are required, wheter that's working with a small number of large files, or a large number of small files. In fairness though, deleting seven million files is bound to take some time. That said, it shouldn't appear to lock up the entire system.

Any component of an operating system has its limits. Seven million files appears to be beyond what explorer on W2k3 can cope with by default. The application was also generating long files names with the dfferences in the names at the end of the filenames which poses an overhead for 8.3 filename generation. It is of course possible to tweak NTFS performance using fsutil to turn off 8.3 filename generation, but I favour leaving things at their defaults unless there is a compelling reason to do otherwise.

Debug logging had been left enabled in the application and was generating the files. It was not required in normal operations so was turned off. A quick format of the volume blew the files away quicker than a traditional delete could ever do. Log file generation reverted to a more respectable level and normal operations were resumed.

If you want to know more about the innards of NTFS, here's some good starting points:

What is NTFS?
How NTFS Works
NTFS Documentation
NTFS.com
Linux NTFS Wiki

B