none
Task Sequence Option: Check Hard Disk Size Before Installation

    Question

  • Hello,

    I do not know if MDT will help me accomplish my task, but I'll give a chance. Here is the scenario: I want MDT to check the hard disk size before installation and if hard disk size is less than or equal to 40 GB, then to format it with the 100% size option and if it is greater than 40 GB, then to format it with 40 GB as C and the 100% remaining as D.

    I think I can use the Preinstall -> New Computer -> Format and Partition Disk option to do that, but frankly I do not know which options I can use.

    Can someone give me a hand here?

    Thanks,

    Tolga

    PS: I'm not using SCCM.

    Monday, August 22, 2011 2:25 PM

Answers

  • Tolga,

    Yes, I think that you would do exactly as you stated - just Add the 'Query WMI' condition.  The WQL statement will be evaluated by MDT and if it's true, the TS will run.  There's an interesting post here that elaborates slightly: http://scriptimus.wordpress.com/2011/06/22/mdt-2010-using-wmi-queries-with-task-sequence-step-conditions/  and additional information in the MDT help file on WMI queries and conditions.

     

    So, if you create 2 task sequences as previously mentioned, the WMI query statement would look like this:

    1. For your < or = 40GB task sequence

    SELECT * FROM Win32_DiskDrive WHERE Index = "0" AND Size <= 42949672960

     

    2. For your > 40GB task sequence

    SELECT * FROM Win32_DiskDrive WHERE Index = "0" AND Size > 42949672960

    Drive size is calculated by # of GBs x 1024 x 1024 x 1024 since we're dealing with bytes.

     

    Arposh mentioned checking the size of the disk, but (if I am not mistaken) MDT does not store this value as a variable during the initial gathering phase and so extra steps would be required.  I think Johan's methodology is probably the easiest and cleanest way.

    • Proposed as answer by David Matan Tuesday, August 23, 2011 2:25 PM
    • Marked as answer by .Tolga BALCI Thursday, August 25, 2011 5:39 AM
    Tuesday, August 23, 2011 2:25 PM

All replies

  • Johan had a good idea here:

    http://www.msfn.org/board/topic/149484-how-can-i-make-custom-partition-sizes-in-mdt-2010/

     

    I imagine you can utilize 2 task sequence steps, each with criteria similiar to Johan's post querying WMI (one for a drive > 40GB, and one for everything else).

    Monday, August 22, 2011 3:20 PM
    1. Create a task sequence step that checks the size of the disk.
    2. Create two task sequence steps that format the drive in the way that you want
    3. On the first one, put a requirement that the drive is larger than 40GB
    4. One the second one, put a requirement that the drive is lesser than or equal to 40GB

    If you found this post helpful, please give it a "Helpful" vote. If it answered your question, remember to mark it as an "Answer".

    Rich Prescott | MCITP, MCTS, MCP

    Blog | Twitter: @Arposh | Powershell Client System Administration tool
    Tuesday, August 23, 2011 12:10 AM
  • Hello David,

    Exactly this is what I am trying to do. My only problem is how to write the condition to check the disk size. Checking Johan's post that you mentioned, he says the condition statement is as below (for a 200 GB disk):

    SELECT * FROM Win32_DiskDrive WHERE Index = "0" AND Size > 214748364800
    

    So, do I insert this query in the "Condition" tab of the Format Disk sequence? 

    Arposh's answer can be the solution, but frankly I do not know how to create a task sequence to check the size of the disk and put the requirement to the sequence. 

    Thanks,

    Tolga

    Tuesday, August 23, 2011 11:28 AM
  • Tolga,

    Yes, I think that you would do exactly as you stated - just Add the 'Query WMI' condition.  The WQL statement will be evaluated by MDT and if it's true, the TS will run.  There's an interesting post here that elaborates slightly: http://scriptimus.wordpress.com/2011/06/22/mdt-2010-using-wmi-queries-with-task-sequence-step-conditions/  and additional information in the MDT help file on WMI queries and conditions.

     

    So, if you create 2 task sequences as previously mentioned, the WMI query statement would look like this:

    1. For your < or = 40GB task sequence

    SELECT * FROM Win32_DiskDrive WHERE Index = "0" AND Size <= 42949672960

     

    2. For your > 40GB task sequence

    SELECT * FROM Win32_DiskDrive WHERE Index = "0" AND Size > 42949672960

    Drive size is calculated by # of GBs x 1024 x 1024 x 1024 since we're dealing with bytes.

     

    Arposh mentioned checking the size of the disk, but (if I am not mistaken) MDT does not store this value as a variable during the initial gathering phase and so extra steps would be required.  I think Johan's methodology is probably the easiest and cleanest way.

    • Proposed as answer by David Matan Tuesday, August 23, 2011 2:25 PM
    • Marked as answer by .Tolga BALCI Thursday, August 25, 2011 5:39 AM
    Tuesday, August 23, 2011 2:25 PM
  • Hi David,

    Thank you very much. I did this, but it did not work. 

    I have added two task sequences and under each I went to Options -> Add If statement -> All conditions are true -> WMI query [<= 40 GB and > 40 GB]. However, during installation only first sequence is checked: the first sequence is >40 GB, but the disk is actually 37 GB. I cannot see what I am missing.

    Any ideas?

    Thank you,

    tolga

    Wednesday, August 24, 2011 8:51 AM
  • Tolga,

    I ran a test using exactly the WMI queries listed above and they worked for me.  Please check the TS log file (smsts.log) and see what the WMI conditions you listed are evaluating to.  When you get the log file, do a search for the key phrase "evaluating a WMI condition expression". 

    Wednesday, August 24, 2011 12:29 PM
  • David,

    I have the following log files:

    • BDD
    • LiteTouch
    • Wizard
    • ZTIDiskPart
    • ZTIGather
    • ZTIValidate

    The installation fails with error, which I asked http://social.technet.microsoft.com/Forums/en-US/mdt/thread/7868c308-ff18-4199-a95f-b9206124b08a

    Maybe somehow related?

    Thank you,

    Tolga


    Wednesday, August 24, 2011 1:02 PM
  • Tolga,

    The BDD.log file will tell you hwere the SMSTS.log file is located. Regards,

    David

    Wednesday, August 24, 2011 1:09 PM
  • Sorry David,

    My mistake. 

    Excuse me.

    Tolga

    Thursday, August 25, 2011 5:39 AM