I already discussed Drive Mapping with IAG several times, but one thing I failed to address properly is the “setup” issue. In the April 16 entry, “Fetch me my files, please”, I’ve explained that for the drive mapping to work, a registry setting must be set on each client. Most users just create the Drive-Mapping setup application, as I detailed in that entry, but that could be a problem as it applies the setting without actually checking if it was already set before. This means that if the administrator sets this app to run on portal access, or as a prerequisite to the regular Drive Mapping app, the user will be prompted to reboot his computer even though there’s no need for that.

I’ve written a little additional customization that helps. It’s based on creating a VBScript file on-the-fly, and it checks the registry setting and proceeds accordingly. If the setting was already present, it will do nothing visible. If it hasn’t, or has been set to the wrong value, it will make the change, and prompt the client to reboot the machine.

This is the code:

@echo on error resume next >DriveMappingRegistry.vbs
@echo t=2 >>DriveMappingRegistry.vbs
@echo Set WshShell = WScript.CreateObject("WScript.Shell") >>DriveMappingRegistry.vbs
@echo key="HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\NetBT\Parameters\SmbDeviceEnabled" >>DriveMappingRegistry.vbs
@echo t=WshShell.RegRead(key) >>DriveMappingRegistry.vbs
@echo if not t=0 then >>DriveMappingRegistry.vbs
@echo     WshShell.RegWrite key, 0, "REG_DWORD" >>DriveMappingRegistry.vbs
@echo     WshShell.Popup "Registry updated. Please reboot your computer" >>DriveMappingRegistry.vbs
@echo end if >>DriveMappingRegistry.vbs
@cscript DriveMappingRegistry.vbs

This piece would ideally be integrated into the drive mapping itself, so it could be either implemented into the customization I suggested in the blog entry “Drive them crazy” (Add it above the line @set Fullusername=%3 ), or, if you plan to use the regular drive mapping, without the user-drive customization, just create a regular customization of the drive mapping application and add this to it.