
registry based scripting to change name based on key's content
Quote:
> I've got a virtual drive emulator which after install
> gives itself a drive letter based on whats free.
> the key puts itself under
> HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices
> the values called "\DosDevices\E:"
> Unfortunatly it wont be the same to every PC on the
> network.
> we want a standard across the network of this virtaul
> drive of H:
> being a simpleminded man, i would like to make up a
> script, i would prefer kix, but vbs will do.
> the hex data contained within the key is the same on all
> machines, so using that, can i delete all known instances
> of \DosDevices\#: that contain the data of
> 5c003f003f005c00530043005300490023004300640052006f006d00260
> 0560065006e005f005a00540065006b0057006100720065002600500072
> 006f0064005f005f004f0043004400450026005200650076005f0031002
> e0030003000230031002600320061006600640037006400360031002600
> 3000260030003000300023007b003500330066003500360033003000640
> 02d0062003600620066002d0031003100640030002d0039003400660032
> 002d003000300061003000630039003100650066006200380062007d00
> so i can reinsert the value that i've made up in kix.
> can anyone help?
Is "E" (or whatever letter) the *only* value under this key? If it is then
it's as simple as importing a .REG file that looks like so:
***File Start ****
REGEDIT4
[-HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices\DosDevices]
***File end****
Note the - in front of HKEY: this means to remove that key and all its
subkeys.
Also note the blank line before the end of the file, this is *IMPORTANT*;
regedit imports fail without the extra blank line. I have no idea why, I
just know that's the case I keep forgetting about :-).
You can then reinsert your desired H: value.
A slightly harder version, if the drive letter is not the only key/value in
this registry branch, is to create a regedit file like so:
***File Start ****
REGEDIT4
[-HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices\DosDevices\E]
[-HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices\DosDevices\F]
[-HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices\DosDevices\G]
and so on, and so on,
[-HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices\DosDevices\Z]
***File end****
You can then reinsert your desired H: value.
This shouldn't take more than a split second to run, no matter which method
you use. Registry searching/parsing/etc with VBS will probably push you
over the subsecond timeframe, if not into multi-second run times.