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.
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.
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.
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.
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?
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!
You could look at scripting diskpart.exe to change the last drive letter to the one that you want:
How to change drive letter assignments in Windows XP
A Description of the Diskpart Command-Line Utility
MSFN Forums > Change drive letters to your liking
AutoIt Forums > change drive letter script
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:
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.Code:@echo off c:\windows\system32\diskmgmt.msc
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 = "."
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
objOutFile.WriteLine "assign letter=K:"
Set objShell = CreateObject ("WScript.Shell")
objShell.Run "diskpart /s C:\diskpart.txt > c:\Logfile.txt", 6, True
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
which should force the script wait while the command is running.Code:objShell.Run "diskpart /s C:\diskpart.txt > c:\Logfile.txt", 1, True
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!
think the files locked. try using
After the close you could try setting the objects to nothing then adding a wait period before trying to access it:
Also, is there any specific reason why you are using objFSO.OpenTextFile rather than objFSO.CreateTextFile ?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"
jack0w (4th August 2008)
There are currently 1 users browsing this thread. (0 members and 1 guests)