+ Post New Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 27
Windows Thread, Sysprep & Drive Letters in Technical; I've just about perfected our configuration of sysprep for use with Ghost so we can image onto different hardware however ...
  1. #1
    jack0w's Avatar
    Join Date
    Jan 2008
    Posts
    123
    Thank Post
    12
    Thanked 4 Times in 4 Posts
    Rep Power
    14

    Sysprep & Drive Letters

    I've just about perfected our configuration of sysprep for use with Ghost so we can image onto different hardware however I have encountered one problem which as of yet I've not been able to solve!

    We are currently using an Avantis OpenCD Server, the client software creates a virtual dvd drive on the computer, by default this will pickup the first available drive letter. When using Ghost on its own I simply changed the drive letter to K: using Disk Management and that was that! However on sysprep'd computers it would appear the drive letter is reset to the first available drive letter.

    I've looked at using Diskpart and some kind of script to change the drive letter to K: combined with the RunOnce element of sysprep. However the problem is some computers in school have physical dvd drives, some do not, some computers also feature a recovery partition and some do not. Therefore the first available drive letter is different from one computer to another. So I cannot simply change it based on the ID in Diskpart or based on the current drive letter since it will always be different.

    Can anyone see a way around this? Is there perhaps a way to script a drive letter change based on the name of the drive in device manager? Clutching at straws here so any advice would be much appreciated.

  2. #2

    Join Date
    Mar 2007
    Posts
    1,787
    Thank Post
    81
    Thanked 294 Times in 225 Posts
    Rep Power
    86

  3. #3
    jack0w's Avatar
    Join Date
    Jan 2008
    Posts
    123
    Thank Post
    12
    Thanked 4 Times in 4 Posts
    Rep Power
    14
    I'm currently using USBDLM to control drive letters mapped to Flash Drives, how can this be used for non-USB devices?
    Last edited by jack0w; 1st August 2008 at 10:28 AM.

  4. #4

    Michael's Avatar
    Join Date
    Dec 2005
    Location
    Birmingham
    Posts
    9,262
    Thank Post
    242
    Thanked 1,572 Times in 1,252 Posts
    Rep Power
    340
    Interesting problem. I usually image machines using a Bart PE/Image for Windows boot CD. Once fully booted, I can browse C:\ (Local Disk) and D:\ DVD Drive. If I'm using an external USB hard drive it uses the next available drive letter - E:\
    Alternatively, if I map a network drive to where the images are stored using a UNC path \\servername\sharename it also uses the next available drive letter E:\. Using either method I then re-image C:\ (Local Disk), then restart and Mini Setup starts.

    It sounds to me that your image software is using the first available drive letter - which I'm guessing would be C:\ which is a little daft if you ask me; unless you can still re-image the local disk even if its setup as D:\ or E:\ ? I've never tried. As for those hidden/restore partitions you'll probably need some other software to delete and merge partitions before imaging.
    You could boot off a standard Windows ISO, delete all partitions, create a single partition, then quit setup prematurely. Your imaging software should then format and restore the image.

  5. #5
    jack0w's Avatar
    Join Date
    Jan 2008
    Posts
    123
    Thank Post
    12
    Thanked 4 Times in 4 Posts
    Rep Power
    14
    When I used Ghost without Sysprep to image computers whatever changes I made in Windows to the drive letters for the DVD drives would still be there after I restored the image to a different computer.

    However its only since I've started using Sysprep that the letters I've assigned to my DVD drives reset after mini setup is run.

  6. #6

    Michael's Avatar
    Join Date
    Dec 2005
    Location
    Birmingham
    Posts
    9,262
    Thank Post
    242
    Thanked 1,572 Times in 1,252 Posts
    Rep Power
    340
    So could you clarify exactly what the problem is, as I am confused. How are you getting to the point where a virtual drive is created? Are you booting from a CD, floppy or USB stick?

    When you're in this 'pre-state', what letters are your local disk, disc drive and virtual drive mapped as?

  7. #7
    jack0w's Avatar
    Join Date
    Jan 2008
    Posts
    123
    Thank Post
    12
    Thanked 4 Times in 4 Posts
    Rep Power
    14
    Sorry, don't think I explained the problem very well.

    The Virtual Drive is created in Windows by installing the software that came with our Avantis OpenCD Server. Once the install of the software completes the drive is the first available letter in windows, I can then change the letter using Disk Management to K: and that's fine, no problem.

    When using ghost without sysprep in the past I would make any other necessary changes to the computer and then take an image of the computer using Ghost. I could then deploy this image to computers with the same hardware, again - no problem.

    However, now I've started using sysprep to create an image which is not hardware dependant. I can configure the computer in the exactly same way as above without any problems, but as soon as the computer boots up after being imaged and having mini setup run the drive which I set to K: prior to taking the image changes its drive letter to the first available again.

    Obviously I'd rather not have to go round to all the computers after they've been imaged and manually change the drive letters back to K: as that would be a nightmare!

    Hopefully that makes more sense than my original post!

  8. #8

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,223
    Thank Post
    874
    Thanked 2,717 Times in 2,302 Posts
    Blog Entries
    11
    Rep Power
    780

  9. #9

    Michael's Avatar
    Join Date
    Dec 2005
    Location
    Birmingham
    Posts
    9,262
    Thank Post
    242
    Thanked 1,572 Times in 1,252 Posts
    Rep Power
    340
    I'm still confused how you're actually imaging your workstations You have Windows already installed and you install some software which creates a virtual disc drive, which you then change to K:\

    At this point how are you re-imaging the workstation!? I'm really curious. As for Sysprep itself re-setting drive letters, it is possible that drive information/configuration is stored within the SID (Security Identifier), which Sysprep resets. I am not 100% sure though!

    When you configured your Sysprep answer file, you can specify a batch file to run under Run Once when you first logon. This will automatically bring up the Disk Management console for you:

    Code:
    @echo off
    c:\windows\system32\diskmgmt.msc
    Save as DiskManagement.bat. This should save you a lot of time. I'm not sure of any ways to automatically change a physical/virtual drive using a script. Network drives are straight forward however.

  10. Thanks to Michael from:

    jack0w (1st August 2008)

  11. #10
    jack0w's Avatar
    Join Date
    Jan 2008
    Posts
    123
    Thank Post
    12
    Thanked 4 Times in 4 Posts
    Rep Power
    14
    Thanks for the suggestions guys, I think I've managed to create a vbscript which will do the trick, however one part of it doesn't seem to work - the command to run diskpart!

    Any scripting gurus able to spot my error?

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objOutFile = objFSO.OpenTextFile("C:\diskpart.txt", 8, True)

    On Error Resume Next
    strComputer = "."
    Dim strDriveLetter
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery("Select * from Win32_CDROMDrive")
    For Each objItem in colItems
    If objItem.Name = "Avantis Open CDMVD001 SCSI CdRom Device" Then objOutFile.WriteLine "Select volume" & " " & objItem.Drive
    Next
    objOutFile.WriteLine "assign letter=K:"

    Set objShell = CreateObject ("WScript.Shell")
    objShell.Run "diskpart /s C:\diskpart.txt > c:\Logfile.txt", 6, True

    'objFSO.DeleteFile "C:\diskpart.txt"

  12. #11

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,223
    Thank Post
    874
    Thanked 2,717 Times in 2,302 Posts
    Blog Entries
    11
    Rep Power
    780
    Have you made sure that the text file is written properly and not locked when you are trying to access it with diskpart. Also have you tried using
    Code:
    objShell.Run "diskpart /s C:\diskpart.txt > c:\Logfile.txt", 1, True
    which should force the script wait while the command is running.

  13. Thanks to SYNACK from:

    jack0w (1st August 2008)

  14. #12
    jack0w's Avatar
    Join Date
    Jan 2008
    Posts
    123
    Thank Post
    12
    Thanked 4 Times in 4 Posts
    Rep Power
    14
    Quote Originally Posted by SYNACK View Post
    Have you made sure that the text file is written properly and not locked when you are trying to access it with diskpart. Also have you tried using
    Code:
    objShell.Run "diskpart /s C:\diskpart.txt > c:\Logfile.txt", 1, True
    which should force the script wait while the command is running.
    I've checked the text file and that is being written as expected, how can I check to see if the file is locked when diskpart is trying to access it?

    I've tried running the command you suggested in a seperate script with the text file already created, and that changes the drive letter to K: as it should.

    Just doesn't seem to work when it is all in one script!

    Thanks for your help on this!

  15. #13

    Join Date
    Mar 2007
    Posts
    1,787
    Thank Post
    81
    Thanked 294 Times in 225 Posts
    Rep Power
    86
    think the files locked. try using

    objReadFile.Close

  16. Thanks to strawberry from:

    jack0w (1st August 2008)

  17. #14
    jack0w's Avatar
    Join Date
    Jan 2008
    Posts
    123
    Thank Post
    12
    Thanked 4 Times in 4 Posts
    Rep Power
    14
    Quote Originally Posted by strawberry View Post
    think the files locked. try using

    objReadFile.Close
    I've just tried adding that line after the last WriteLine and adding a sleep in between creating the text file and starting diskpart - no joy!

  18. #15

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,223
    Thank Post
    874
    Thanked 2,717 Times in 2,302 Posts
    Blog Entries
    11
    Rep Power
    780
    After the close you could try setting the objects to nothing then adding a wait period before trying to access it:

    Code:
    Set objFSO = nothing
    Set objOutFile = nothing 
    WScript.Sleep(5000)
    
    Set objShell = CreateObject ("WScript.Shell")
    objShell.Run "diskpart /s C:\diskpart.txt > c:\Logfile.txt", 6, True
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objOutFile = objFSO.OpenTextFile("C:\diskpart.txt", 8, True)
    If objFSO.FileExists("C:\diskpart.txt") then objFSO.DeleteFile "C:\diskpart.txt"
    Also, is there any specific reason why you are using objFSO.OpenTextFile rather than objFSO.CreateTextFile ?

  19. Thanks to SYNACK from:

    jack0w (4th August 2008)

SHARE:
+ Post New Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Computing Letters
    By Diello in forum BSF
    Replies: 4
    Last Post: 28th May 2008, 02:46 PM
  2. Vista SP1, Sysprep & UserLock...
    By Gatt in forum Windows Vista
    Replies: 2
    Last Post: 7th March 2008, 01:25 PM
  3. Sysprep & Ghost
    By cgiuk in forum How do you do....it?
    Replies: 13
    Last Post: 26th November 2007, 09:14 AM
  4. Replies: 3
    Last Post: 25th October 2007, 09:14 AM
  5. Replies: 4
    Last Post: 9th October 2006, 10:00 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •