Ask a questionAsk a question
 

Answertasksequence WMI query

  • Friday, November 06, 2009 7:41 AMAZIT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,
    I'm trying to include a WMI Query for selecting different "Format and Partion Disk" tasks depending on computer modell. I would like to use on task for model HP 3530p and ond task for all other modells to apply differenent partitioning.

    SELECT * from Win32_ComputerSystem WHERE Model LIKE "%2530%" does work fine

    SELECT * from Win32_ComputerSystem WHERE Model NOT LIKE "%2530%" does not work at all ! Test query returns an error - invalid syntax, so I tried
    SELECT * from Win32_ComputerSystem WHERE Model != "%2530%" and Test query returns no error (valid syntax).
    Running the task sequence "fails" - so 2530 modell do run the task including the "where Model != "%2530%" as well.

    Did I miss something, wrong syntax ?

    (running SCCM 2007 SP2)

    thanks 

Answers

  • Friday, November 06, 2009 6:06 PMsveske Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi..

    Think the syntax is wrong:

    Yours is: SELECT * from Win32_ComputerSystem WHERE Model NOT LIKE "%2530%"


    I use: SELECT * from Win32_ComputerSystem WHERE NOT Model LIKE "%2530%"


    Took me a while to figure this syntax out.... ;-)

    But it works in my TS.

    Regards
    • Marked As Answer byAZIT Monday, November 09, 2009 8:16 AM
    •  

All Replies

  • Friday, November 06, 2009 10:02 AMTorsten [MVP]MVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Running the task sequence "fails" - so 2530 modell do run the task including the "where Model != "%2530%" as well.
    Are you saying that the TS condition is working, but the step is failing? If so: which error are you getting?
  • Friday, November 06, 2009 12:45 PMAZIT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Yes the tasksequence is working, if I disable the "faulty" task with the WMI query "SELECT * from Win32_ComputerSystem WHERE Model != "%2530%""- all other tasks do run without any error.

    The error I do get:

    Using query SELECT * from Win32_ComputerSystem WHERE Model != "%2530%"
    The task sequence execution engine failed executing the action (Partition Disk - two partitions) in the group (Partition Disk) with the error code 2147549183
    Action output: ==============================[ OSDDiskPart.exe ]==============================
    Command line: "osddiskpart.exe"
    Succeeded loading resource DLL 'X:\sms\bin\x64\1033\TSRES.DLL'
    Reading partition size info for partition 0
    Remaining size before partition:80023749120
    size units: SIZE_GB
    Set partition size: 107374182400
    cbRemainingSize >= cbLength, HRESULT=8000ffff (e:\nts_sms_fre\sms\client\osdeployment\osddiskpart\main.cpp,612)
    LoadPartitionConfiguration( i, oDisk, cbDiskSize, cbContainerPartitionSize, pCurPartition), HRESULT=8000ffff (e:\nts_sms_fre\sms\client\osdeployment\osddiskpart\main.cpp,751)
    LoadDiskConfiguration(oDisk), HRESULT=8000ffff (e:\nts_sms_fre\sms\client\osdeployment\osddiskpart\main.cpp,1412)
    Partition 0 larger than remaining disk space. Requested partition size: 107374182400, remaining size: 80023749120
    Invalid configuration specified.  Please ensure that the task sequence is properly configured.
    OSDDiskPart.exe failed: 0x8000ffff. The operating system reported error 2147549183: Catastrophic failure 

    This error is ok  as the task is trying to create a partition larger in size than the physical. 

    The problem is - this task should not be started at all - the WMI query should return something like:

    The task sequence execution engine skipped the action (Partition Disk - two partitions) in the group (Partition Disk) because the condition was evaluated to be false. 


    More details from the task sequence:

    Right after "Restart in WinPE" I added Group "Partition Disk" with condition (Task Sequence Variable _SMSTSClientCache not exists), within that group I added two tasks.
    1) "Partition Disk - two partitions" with condition SELECT * FROM Win32_ComputerSystem WHERE Model != "%2530%"
    2) "Partition Disk - HP2530p" with condition SELECT * FROM Win32_ComputerSystem WHERE Model LIKE "%2530%"


    Andreas
  • Friday, November 06, 2009 2:01 PMJason SandysMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    For the condition change the query to SELECT * from Win32_ComputerSystem WHERE Model LIKE "%2530%" but group it under an If statement with a condition of none of the following is true.
    Jason | http://myitforum.com/cs2/blogs/jsandys | http://blogs.catapultsystems.com/jsandys/default.aspx | Twitter @JasonSandys
  • Friday, November 06, 2009 6:06 PMsveske Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi..

    Think the syntax is wrong:

    Yours is: SELECT * from Win32_ComputerSystem WHERE Model NOT LIKE "%2530%"


    I use: SELECT * from Win32_ComputerSystem WHERE NOT Model LIKE "%2530%"


    Took me a while to figure this syntax out.... ;-)

    But it works in my TS.

    Regards
    • Marked As Answer byAZIT Monday, November 09, 2009 8:16 AM
    •