On Tue, Feb 7, 2012 at 2:04 AM, Sytze de Boer <[email protected]> wrote:
> Friends
> I look after the IT requirements for a client who either does not know
> or does not want to know anything anything to do with her computer.
> She want to click a desktop icon and it should always work as intended.
>
> So we provided her with an icon that does a backup of specific folders
> and files exactly as she wants it, to an external hard drive
> There is just ONE problem, 1 day the external Hdd is G drive, the next
> day it is H drive.
> There is no pattern as to when it is H or G drive
> We can't figure why/how it changes the drive letter
>
> It is driving both of us nuts
> Can anyone help with this ?

Hi Sytze,

I have a VBS script that I run as part of my backup script.  It
substitutes the first USB drive found to drive X:
At the end of the script I remove the mapping:

# Backup.cmd
vol X:
if errorlevel 1 goto no_x
subst x: /d
:no_x

"c:\Program Files\7-Zip\7z.exe" a D:\%1.7z [email protected]
[email protected] -mx=1 -p<password> > Backup_01.log
subst x: /d



# MapDrive.vbs
ComputerName = "."
Set wmiServices  = GetObject
("winmgmts:{impersonationLevel=Impersonate}!//" & ComputerName)

' Get physical disk drive
Set wmiDiskDrives =  wmiServices.ExecQuery ( _
    "SELECT Caption, DeviceID FROM Win32_DiskDrive")

For Each wmiDiskDrive In wmiDiskDrives
    'Use the disk drive device id to find associated partition
    query = "ASSOCIATORS OF {Win32_DiskDrive.DeviceID='" _
        & wmiDiskDrive.DeviceID & "'} WHERE AssocClass =
Win32_DiskDriveToDiskPartition"
    Set wmiDiskPartitions = wmiServices.ExecQuery(query)

    For Each wmiDiskPartition In wmiDiskPartitions
        'Use partition device id to find logical disk
        Set wmiLogicalDisks = wmiServices.ExecQuery _
            ("ASSOCIATORS OF {Win32_DiskPartition.DeviceID='" _
             & wmiDiskPartition.DeviceID & "'} WHERE AssocClass =
Win32_LogicalDiskToPartition")

        For Each wmiLogicalDisk In wmiLogicalDisks
           if instr(wmiDiskDrive.Caption, "USB Device") > 0 then
              ' Substitute X: for the volume
              Set WshShell = CreateObject("WScript.Shell")
              WshShell.Run("Subst X: " & wmiLogicalDisk.DeviceID & "\")
           end if
        Next
    Next
Next




-- 
Paul

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/cadwx0++vqgz5dyjkjpx41wxel3i+zlfn4ygyk3t1qxy_sfy...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to