Deployment Solution

 View Only
  • 1.  Running tasks based on Model

    Posted Oct 15, 2015 02:23 PM

    Hey there,

    So I looking to run some tasks based on the Model of the machine.

    My current scenario is I'm looking to copy drivers based the model #.

    Eg. I have a Latitude E7450 & E6410 and I have a network share \\server\Drivers (Each Model has it corresponding folder E7450,E7440,E6410 etc. within) 

    So i was hoping for it to see that it's a Latitude E7450 and then copy the drivers from \\Server\Drivers\E6410 and copy it to C:\Drivers.

     

    I've tried some suggestions from here . But I'm obviously missing something,

    What tried was, creating a Task --> Run Script

    I then pasted this

    FOR /F "tokens=2 delims==" %%G IN ('WMIC baseboard get product /format:VALUE') DO SET Model=%%G

    ECHO Model: %Model%

    if "%model%"=="Latitude E7440"  goto E7440
    if "%model%"=="Latitude E7450"  goto E7450

    REM If we didn't find a match, just exit
    goto Exit

    REM LAPTOPS

    :7440
    ROBOCOPY /E "\\server\Drivers\E7440" C:\Drivers
    goto Exit

    :7450
    ROBOCOPY /E "\\server\Drivers\E7450" C:\Drivers
    goto Exit

    :Exit

    exit

    I then do a Quick run against my test machine, I see a quick dos screen come up and go away. But nothing is coping and the task still shows as running.

    If anyone could point me in the right direction, it would be great.

    Thanks

     

     

     



  • 2.  RE: Running tasks based on Model
    Best Answer

    Broadcom Partner
    Posted Oct 16, 2015 04:53 AM

    Hi

    I didn´t check the "FOR" loop but what i can see is that the "jump mark" is wrong. You are missing the "E" in front of the jump mark.

    if "%model%"=="Latitude E7440"  goto E7440
    if "%model%"=="Latitude E7450"  goto E7450

    REM If we didn't find a match, just exit
    goto Exit

    REM LAPTOPS

    :E7440
    ROBOCOPY /E "\\server\Drivers\E7440" C:\Drivers
    goto Exit

    :E7450
    ROBOCOPY /E "\\server\Drivers\E7450" C:\Drivers
    goto Exit

    :Exit

    exit

     

    Network23



  • 3.  RE: Running tasks based on Model
    Best Answer

    Posted Oct 16, 2015 05:28 AM
    To troubleshoot I either echo out the variables to a file: ECHO Model: %Model% >"%temp%\model.bat" And/or put a "Pause" at the end of the script so the CMD windows doesn't disappear.


  • 4.  RE: Running tasks based on Model

    Posted Oct 16, 2015 11:54 AM
    How about a mapping to that share because the task runs with local system rights?


  • 5.  RE: Running tasks based on Model

    Posted Oct 16, 2015 03:10 PM

    Thanks

     

    Network23 i completely missed the typo
    andkn101 pausing it allowed me to see i was using the wrong product number.

    My only issue now is I have to make a Run Script to map a drive to the driver Dir and then run the script above. If i dont do net use first i get access denied even though the Altiris account has rights to the share?



  • 6.  RE: Running tasks based on Model

    Posted Oct 17, 2015 03:38 PM
    The task runs as a local system by default and inside winpe you can not use 'run as' because the client is not a domain member.