Ghost Solution Suite

 View Only
  • 1.  Howto detect the right dst drive in batch-mode?

    Posted Feb 11, 2011 11:42 AM

    Hello,

    i'm trying to fasten up my installing proedures. I've setup up a PXE, everything is working fine with it, but i have a little problem. In my batch i use the dst=1 switch to define the target. Sadly its possible that there are switched cables or something else inside the PC, so there is a disk - that must not be overwritten - which goes prior my target HDD.

    I'm not sure why, but my destination drive it not on first place now. Sometimes second, sometimes first, depending if there is also a USB-Stick or something...

    Is there a way, to recognize the correct dst?

    My target drive is 74GB big, other drives always bigger or smaller, never the same.

    I thought of testing the drive with a size in the commandline, to test if i can make the partition exactly 74GB big. Then take the errorlevel and know if its possible or not, but i'm not sure if this is the correct idea... :/

    Is there someone who can give me a hint?

     

    Greetings

    Max



  • 2.  RE: Howto detect the right dst drive in batch-mode?

    Posted Feb 11, 2011 02:32 PM

    Are you running your batch mode process under PCDOS or WinPE ?

    If you are using WinPE, you can use WMI in script to establish specific information about your target drives, including whether they are USB or not. This is the most accurate way nowadays of getting information about the machine hardware and making sure you do not overwrite the wrong volume.

    I also found (a long time ago) that some machines booting a PCDOS boot image from a USB stick would boot to A: and some would boot to C: - this seemed to be a function of the bios and there was no way of changing the boot letter.

    So in this case, I put a "flag file" on the bootable device, and looked for it in my batch file, so I could always check if my C: drive was the USB boot key or the machine's own hard disk. If it was my stick, then the machine hard disk was on D: 

    No doubt you could develop similar logic for your machine inventory if you are stuck with a PCDOS boot rather than a WinPE boot.



  • 3.  RE: Howto detect the right dst drive in batch-mode?

    Posted Feb 12, 2011 08:48 AM

    Currently i'm on PCDOS, but the idea of WinPE is not bad. I'm trying to get these silly Intel 82567LM Nic running, then it would be a cool system, if its stable. Hints are welcome :)

    Using WMI language is a nice idea, know about it from some other project i'm working on currently. But i think i wouldn't have .NET runtime in PE, right? :)

    Greetings

    Max



  • 4.  RE: Howto detect the right dst drive in batch-mode?

    Posted Feb 12, 2011 05:40 PM

    I have used WMI scripting extensively under WinPE, in the form of an HTA file which allows you to use IE as a basic GUI in your WinPE environment.  WinPE also supports the addition of drivers to support any hardware for which native support is not available. My article here: Adventures with WinPE Symantec Connect  covers the basics of how to get yourself into WinPE using freely available downloads from MS, and since it is based on WinPE V2, you can use any Vista 32 bit drivers to add to the currently supported hardware. (WinPE V3 is based on the Windows 7 kernel instead of Vista, so can be used instead, but there are some differences in preparing the bootable media) 

    GSS 2.5 also uses WinPE V2 but automates operations such as adding driver support so you don't have to mount and unmount WIM files and do it all manually.

    If you need a .NET runtime in PE then I think you are out of luck. It is not needed for WMI, and for the range of command line operations that WinPE can handle, but then WinPE was never intended to be anything more than a pre-installation command line environment, so its capabilities are severely limited compared to the full operating system.



  • 5.  RE: Howto detect the right dst drive in batch-mode?
    Best Answer

    Posted Feb 26, 2011 11:26 AM
      |   view attached

    I had success on this. My Solution:

    Firstly i switched to WinPE, it was some strange Work, and i don't know exactly how i got it working, but it's done. WinPE sets my HDD to Disk1, no matter if its Raid or not. Also no matter if there is something plugged in, like USB-Sticks or something.

    Secondly i found my workaround to check if i'm on the correct system, and feel safe to not erase my Working System :) I use "dmidecode.exe" with a small self-created script, written in "AutoIT V3" because WMI was not working on my WinPE. I wrote a little .exe with a simple return value of 1 or 0, depending if the given string was found.

    I've attached my little Script. dmidecode is licensed under GNU. Not sure about AutoIt - and because i don't like unknown executables - i attached my sourcecode. Hope someday someone will find this and say thanks :)

    Greetings

    Maxxxx

    Attachment(s)

    zip
    checkDmi.zip   36 KB 1 version