Monday, September 27, 2010

Assign the same Drive Letter Every Time to USB Drive

How can you make sure that the same drive letter is assigned every time you plug in your USB drive? How can you exempt drive letters assigned to Network drives?

If you right click a drive in Disk Management and assign it a drive letter you are pretty much assured that you will get that drive letter next time-but you can't really be 100% sure.

You also run into problems when a user plugs in a USB drive and then your Network drive letter does not work.

My problem at hand this time was making sure that my mom's USB drive always got the letter E assigned to the USB drive I gave her. I had written a script that mirrored her picture folder. There is no way my 77 year old mother is going to be able to trouble shoot something weird like that.

The solution came via a utility quite a few others recommend: USBDLM.

Here is what I do with USBDLM:

1. Make sure I always assign the same drive letter to USB drives.
2. Make sure my network mapped letters do not conflict with USB drive letters.
3. You know those multi-media readers that have a slot for each type. Each one of those show up as a drive letter even though you do not have a card inserted. USBDLM can make it so a drive letter is assigned only when you insert one.
4. I assign drive letters based in Device IDs.
5. Make the drive letter be assigned by ini file on USB and not conflict with INI file on Computer.

USBDLM is free for personal use, but there is a price for business. The price I found is quite reasonable. The work it does really can't be beat. Ther are more options that I will cover here including working with Firewire. There is also a pretty extensive help file.

I am going to cover the 5 steps above by basically just showing you my INI file. WSBDLM is controlled by INI files.

Please excuse the semicolons since if you would put this into an actual ini, it would be the comments. You could just pear it down. Also I built it based on the template that is included.

; This is my working USBDLM.INI
; Created 9/18/2010

; More informations in the help file USBDLM_ENG.CHM

;------------------------------ Settings -------------------------------------

;here you can let USBDLM remove driveletters of cardreaders as long
;as there is no media present this is done by setting it to "1"

;here you can let USBDLM write a logfile, default is _USBDLM.LOG in
;the root of the Windows drive

;---------------------------- BalloonTips -------------------------------------

;this activates balloon tips and sets their show
;duration in milliseconds-it gives a nice
;message down in the service tray when you plug in your USB device

;-------------------------- the drive letters ---------------------------------

;here you can define new default drive letter for USB drives
;The first line says look at the ini on usb first.
;In that ini put the letter you want for
;that drive.
;comment out everything on the usb except the section below
;omitting the first line.
;Also, lines Letter= contain USB drive letters you want to assign in that sequence
;to other USB devices you plug in.
;So here the first line says: look on usb drive for ini and set letter from that
;then after that, start with k,l,m to other usb drives

;here you can define drive letter that shall never be used for new local drives
;configure here your network and subst drives here but no local drives!

;many other options are documented in the Help files.
;Here is how you assign letter by device ID number.
;Below, while usb is connected do a cmd,
;then dir e:\*.x and then copy paste vol serial
;below (e: is whatever drive letter has at the time).
;Here we will give Y to one, Z to the other.
;finding the vol serial that way is sure
;that you will give the drive the letter you want




Sunday, September 26, 2010

Backup Mom's Pictures Robocopy Batch file

My 77 year old mother travels to fairer weather in late fall. She has a laptop. I needed for her to back up her picture files on a regular basis. It had to be easy. It had to be free. I could not count on any other backup operation because it is hard for my mom to remember backup procedures.

My solution was to use an old and tried and true method. I have used "robocopy (Robust File Copy)" since back in the bad old days of NT 4.0. Robocopy is part of the 2003 Resource Kit, but it should be part of Vista and Windows 7. The result is the following batch file. I then just put a shortcut on her desktop and made sure she knew how to plug in the USB drive and double click on it.

The highlight of the batch file is the "if" statement section:

The first line checks for the existence of a drive "e" --- Her USB drive.

* if exist e: (

If it does exist, I call the robocopy program. Robocopy is fast once the initial copy-it only copies add/move/or changes-it will not copy existing un-modified old files. I used to mirror terabyte of data with it rather fast. It also creates a log file.

* c:\bin\robocopy "c:\documents and Settings\mom\My Documents\My Pictures" e:\momspictures\ /v /mir /r:1 /w:1 /eta /log:c:\bin\picbakup.txt

The above disected (there is a lot more optional parameters):
1. c:\bin\robocopy-This calls robocopy which I put in a folder called "bin"
2. "c:\documents and Settings\mom\My Documents\My Pictures"-This is the source. Notice " because of spaces in some folders.
3. e:\momspictures\-The target folder. I created the folder ahead of time and did an initial copy of all files.
4. /v /mir /r:1 /w:1 /eta -V is vervous, mir means mirror which will delete files that are not longer present. It is a true mirror. r:1 retry times, w:1 wait time. eta Show Estimated Time of Arrival of copied files
5. /log:c:\bin\picbakup.txt-Write a log

The rest of the "if" is an "else", which basically jumps down to tell mom that "e" is not available. (By the way, I made sure that the USB will always be "e" - more on that in different blog entry).

* ) else (
* goto noexist
* )
* goto done

The rest of batch, if successful, will open up the log file, then quit.

***** Here is the whole batch file *****

@echo off
echo Mom, I am copying files from your picture folder to the thumbdrive
echo Please put the thumb drive in first in the computer and wait
echo for it to be recognized.
echo Ok, now hit any key on the keyboard to continue, for example the SPACEBAR

if exist e: (
c:\bin\robocopy "c:\documents and Settings\mom\My Documents\My Pictures" e:\momspictures\ /v /mir /r:1 /w:1 /eta /log:c:\bin\picbakup.txt
) else (
goto noexist
goto done

echo Mom, I can't find the E: drive.
echo Please make sure you can see E: on your computer first then try again.
echo Sorry. Hit any Key on the Keyboard to quit now please!
goto quit

echo OK done!
echo When you hit the next key, the log file will open.
start c:\bin\picbakup.txt
goto quit



Friday, September 24, 2010

Using CHAP with Equallogic SAN

ISCSI connection hit limit. Only 15 connections allowed to one Equallogic Lun (Volume). I am not talking about total number of ISCSI connections to the whole SAN, but to one LUN.

This can happen in a cluster of VMWARE VSphere servers. Having 7 servers each having two connections (dual ISCSI HBAs) to a Volume on Equallogic is 14. Now if you add the 8th that would be 16. Equallogic limits the connection access by IP to 15. This cannot be fixed through firmware upgrade.

What can you do? Use CHAP.

To set up CHAP in Equallogic is simple:

1. In the Group Page of the Management select ISCSI Connection.
2. Here you will see at lower left where to add the ISCSI user.
3. You need to add a Username and a password (The password has to be at least 12 Characters).

4. In the Volume Access itself, you can select Chap authentication, and all you do is just to add the user.

5. In the Source (The machine you are going to connect from), set up ISCSI with CHAP authentication to the target. You will need the username and password you set up on the Equallogic box.

The only perceptible gotcha that I saw using this method was that now on any ISCSI source that has access to that subnet, will see all available LUNS (Volumes) being published. The way around it is to add a second restriction. We opted for IP Range. Adding an IP Range as 192.168.10.* will act as a filter. The only Sources that will see this are ones with a NIC in that range. The other option is to add the iqn identifier, we did not try that. But remember-just because you can see it does not mean you can connect to it because you now have Chap controlling the access.


Event ID 53258

How to fix it here.


Thursday, September 23, 2010

Eight Steps to Help a Great Grandmother with Her Laptop

My 78 year old mother, grandmother, and great grandmother, has a laptop. My mother also spends half the year in Florida. Who do you think helps her with her tech support? Yes, her son-me. The other question, is, what do you think a great grandmother does with her laptop? Mostly surf the internet, email, play card games, and most of all look at family pictures. Since my mother is often far away I need to be able to make sure that when she needs help, I can help her. But better yet hopefully that she will not need my help much.

Here are some of the things I did to help my mother with her computer tech support needs:

The first I did was make sure that I could remotely control her computer. I installed Logmein (free) version. When my mom has something that I cannot explain over the phone, I can remotely help her with Logmein. It has proved a very reliable and secure way to help and fix her problems from far away.

The Second thing I did was to use Dropbox on her laptop. Now I made sure she had one folder shared with me. Sharing files with mom now is a drag and drop! I can even do this from any computer without Dropbox installed. All I need is a browser. Very cool.

Now the third thing is to keep her computer bug free. I installed Avast free. I periodically check it to make sure it is in good working order and all updates are happening in a regular basis. I also keep a copy of CCleaner that I run periodically.

Step Four: Because my mom is on XP, I set up a scheduled job to automatically to run every week to defragment her hard drive for her. I also used ERUNT and NTREGOPT to run at every log in to keep her registry fast and backed up.

Step five was more of a Goal: Teach my mom to use Firefox. This way she has two browsers to use in case Internet Explorer get’s compromised. She actually uses Firefox more than IE.

The sixth step is pretty crucial. Pictures is major part of my mom's computer experience. They also represent the most important, if not the only files on her laptop that cannot be replaced. To assist here with both user experience and file backup. I installed Picasa and taught her how to use it. Took a bit. The things I concentrated on was importing pictures, creating and organizing the pictures using Picasa, and burning CDs of the pictures.

Now I needed her to back up her pictures. I found that trying to teach her how to copy files from her My Pictures folder to a USB thumb drive challenging. The thing is that folders, copy and paste commands were hard for her. It was not something she does often, so she would forget. Even though I could of set up a program like Carbonite or use Dropbox both solutions were not good for her. One she does not want to spend any money, and Dropbox free is too small in size.

What I did was get her an 8GB USB thumb drive, and then wrote a simple script using Robocopy to copy any new Pictures since the last copy to it. All she would have to do is put in the Thumb Drive. Then Double Click on the short cut I put on her desktop. (To see the script and how I made sure that that the USB always got the same Drive Letter Number follow these Links: Backup Mom’s Pictures, Assign the Same Drive Letter to USB drives)

Step seven really is a combination of two things: One put all her often used programs as shortcuts on her desktop. That is probably nothing new. The other was a little coaching. I told her not to let anyone else touch her computer. I found that often she would let other seniors help her, and they would do things that were not as good for her laptop. They meant well, but they are not aware of best practices.

The eighth step are bookends. When she first got her laptop, I created an image of the factory Image using Ghost and burned to DVD and stored it. Then I installed the Windows Home Server Client Software (I have a Home Server). and made sure my Home Server backed up her laptop before she went away to Florida. Worst case scenario, all she has to do is ship me her laptop and I can do a full restore.

After all I did when I was young, is the least I can do for mom!


Wednesday, September 22, 2010

Editing Grub2 Multiboot

I have a multi-boot laptop. I dual boot between Ubuntu 9.x and Windows 7. Grub is the boot loader. The default OS in my Grub was the latest build of the Kernel. Windows 7 was the last in the list. I wanted Windows 7 to be the default choice.

Apparently Grub2 is a little more complicated to edit-at least it seemed at first. The older Grub boot loader all you had to edit was the menu.lst file. Grub2 was made in such a way to protect the system and provide more features.

If you Google this issue you will run into a lot of entries about how hard it is. Some also give what I think is wrong instructions.

First just a little more information:

The old file to edit was in /boot/grub/menu.lst - this is a text file that you could edit by entering this command: sudo gedit /boot/grub/menu.lst. But, Grub2 is configured a little different. The file that controls how Grub boot is /boot/grub/grub.cfg.

Grub.cfg is actually read only, and while you can change that and edit it-the file itself warns you about editing it. See the following from the beginning of the file:

# It is automatically generated by /usr/sbin/grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub

### BEGIN /etc/grub.d/00_header ###

Now this file is edited by Grub itself.

The solution though is rather simple. All you have to do is edit the /etc/default/grub/grub. This file is actually used to build the one read upon boot.

Here is what mine looked like:

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`

# Uncomment to disable graphical terminal (grub-pc only)

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux

# Uncomment to disable generation of recovery mode menu entrys

The most important line is at the top:

The default is the OS in order from the grub.cfg to default to if you don't make another selection from the menu. One point here is that the list starts with "0". So O is the first, and usually the default: GRUB_DEFAULT=0. So count to see which number you need.

In the /boot/grub/grub.cfg each choice starts in the file with: menuentry. So just count how many lines start with menuentry starting with "0". In my case, I counted 10: 0,1,2,3,..,10. The actual full entry below:

menuentry "Windows 7 (loader) (on /dev/sda1)" {
insmod ntfs
set root=(hd0,1)
search --no-floppy --fs-uuid --set 707c80a97c806c22
chainloader +1

So once you are done editing the /etc/default/grub/grub file, you must run this command:

sudo update-grub

Now next time you boot, you will have the new default.


1. Look at the /boot/grub/grub.cfg and count the lines from 0 to see what number the OS you want is to be the default.

2. Edit the /etc/default/grub/grub file-the line with the GRUB_DEFAULT={put your number here}.

3. After saving the file, run sudo update-grub.

4. Reboot.


Saturday, September 18, 2010

Event ID: 7000 Vstor2 P2V30 Virtual Storage Driver service failed

Here was a little nasty leftover. I did not do the actual p2v, so when I found the error in the event viewer at first I was a little perplexed-but I found the fix by doing a little detective work. If you have the same error, consider the following:

VSTOR-P2V30 is left over from P2v

Event Type: Error
Event Source: Service Control Manager
Event Category: None
Event ID: 7000
Date: 9/16/2010
Time: 9:06:35 AM
User: N/A
Computer: BBB123
The Vstor2 P2V30 Virtual Storage Driver service failed to start due to the following error:
The system cannot find the path specified.

For more information, see Help and Support Center at

Careful with Registry on this. Export Key(s) just in case.

1. I tried stopping the service and removing from startup but I still got error.

2. I also deleted it from the System --- show hidden devices.

3. I searched in Registry for: vstor2-p2v30.

4. Found it in: hkey_local_machine\System\ControlSet001\Services\ and hkey_local_machine\System\ControlSet002\Services\, and hkey_local_machine\System\CurrentControlSet\Services\

5. After exporting the keys just for safety --- I deleted:
hkey_local_machine\System\ControlSet001\Services\ and hkey_local_machine\System\ControlSet002\Services\

6. Could not delete the last one.

7. Error went away


EVENT ID 10021

If you put on Windows Updates, you would think you are getting rid of issues-not creating issues. This is why it is so profitable to be a Windows Geek. The amount of money you can make just fixing what does not have to be fixed :)

Event Type: Error
Event Source: DCOM
Event Category: None
Event ID: 10021
Date: 9/16/2010
Time: 9:32:10 AM
User: N/A
Computer: BB123
The description for Event ID ( 10021 ) in Source ( DCOM ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: {61738644-F196-11D0-9953-00C04FD919C1}.

1. On the Server, click Start ? Run, type “dcomcnfg” and click OK.

2. Expand Component Services\My Computer\DCOM Config.

3. Right click “IIS WAMREG admin Service”, select Properties.

4. Go to the Security tab, click the Edit button of “Launch and Activation permissions”.

5. Add Network Service with Local Launch and Local Activation permissions

6. Click OK to exit.


.Net Framework Update causes this on W2k3 Servers

Here is rampant error I have seen after applying Windows Updates:

Event Type: Error
Event Source: .NET Runtime Optimization Service
Event Category: None
Event ID: 1103
Date: 9/16/2010
Time: 8:24:21 AM
User: N/A
Computer: BBB123
.NET Runtime Optimization Service (clr_optimization_v2.0.50727_32) - Tried to start a service that wasn't the latest version of CLR Optimization service. Will shutdown

Fixed it this way:
Downloaded: NDP20SP2-KB974417-x86.exe

1. Run NDP20SP2-KB974417-x86.exe -X
2. In the “choose directory” box, enter “C:\kb974417” (whatever you want to name it)
3. Then go to C:\kb974417, using explorer
4. Doubleclick the file NDP20SP2-KB974417.msp to install
5. Reboot your computer.

If you are using Windows Update server, you might have to reset:

At command prompt: wuauclt.exe /detectnow

Got to love updates!


Monday, September 13, 2010

Citrix or Terminal Techbyte!

Something or someone disables logons on your Citrix or Terminal server and logons never get enabled.

Now you have a server nobody can log into and you are clueless about it.

If you have Nagios working in your environment-Here is a solution to send alert.

Prerequist: Nagios, NRPE addon, Nagios Agent installed on Windows Server, and a program that can read Reg key and communicate with Nagios.
There is a Nagios utility out there created already, but it contains a serious bug that cannot read a value of Zero properly.

Working together, here is what our team came up with.
We created a custom utility with AutoIT and called tsnenable.exe

Here is the code:

;tsenable - purpose to read registry key for value to see if Terminal Services Logons are enabled 0 or disabled 1
;then based on that, it does either of these two things: 0, then write to console message and set exit code to 0
;else if 1, then write to the console, and set exit code to 1.
;This must be compiled as a non-gui application for it to work.
;This is to be used in conjunction with nagios

;Written by:
;September 1, 2010

dim $RegVal, $i

$RegVal=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "WinStationsDisabled")
If @error <> 0 Then
MsgBox(0, "oops", "Crap! This is not working!")
if $RegVal = 0 then
ConsoleWrite("Logons Enabled")
ConsoleWrite("Logons Disabled")

Note: You must compile this as a Command Line Interface not GUI!

Now the actual steps:

1. Install newer nsclient on Citrix server. If you have old client, uninstall that one first then install nsclient_3.6RC8 and get it working with Nagios.

2. Create a folder called nsscripts put the custom app in that folder.

3. Put nsscripts in the NSclient++ program files folder.

4. Rename nsc.ini in NSClient++ to

5. Edit nsc.ini in the NSclient++ folder. I am only going to cover the part for running custom scripts.

[External Script]

[NRPE Handlers]
; *********** Custom app **********

6. Reastart Service for nsclient.

7. Create nagios service entry in services.cfg
This is Linux so you have to use vi or nano editor:

vi services.cfg

NOTE: service_description below uses "check_command" from nrpe2 which calls the tsenable.exe.
In the INI file above notice the "check_tslogon" setting pointing to the custom tsenable.exe.

# Service definition
define service{
use generic-service ; Name of service template to use

host_name CITRIX1
service_description TS Logons
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups citrix-admins
notification_interval 360
notification_period awakehours
notification_options w,u,c,r
check_command check_nrpe2!check_tslogon

8. Restart Nagios.


Sunday, September 12, 2010

Save Putty Settings

Putty is probably a universal tty/ssh/telnet program used by computer profesionals the world wide.

I know that I have used it ever since I learned about it, and cannot remember the time that I started using it.

The one thing that irritated me is that if I installed Putty on another machine I would lose my settings.

Backing up your "settings" is easy, but you have to manually do this. You have to export Reg keys, then import them.

The Reg key is:

HKEY_CURRENT_USER\Software\Joshua F. Madison

To Export: (No I am not going to warn you about messing with the registry. If you are using Putty, you are in my mind
already a techie, and I am not going to insult your intelligence.)

1. run "regedit"
2. Go to the key:HKEY_CURRENT_USER\Software\Joshua F. Madison
3. Export

On the target machine, double click the *.reg file, and import it.

That is all there is to it.

You could of Googled it, and maybe you did and ended up here.